Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Jan 2006
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creaing custom calendar in mailmerge doc (word 9.0)

    Hello again.

    I'm trying to make a mail merge document out of a.csv file. This works fine. (Thank you HansV)

    In the csv-file are dates on which people must take medication and the dosage, in columns named day1, day2, day3 etc in each cell are values like 0,5, 1, 2, 1 etc. The targetdocument (is that a word?) contains a table made out of 7 rows (representing weekdays) and 7 columns, see the attached document. The start date of medication is present in the csv file. Out of the start date I can calculate the weekday, using the weekday function. What I want is that the startday of the dosage is printed in the right weekday. So that if the startdate is on a wednesday, the first dosage is printed in the right cell.

    Is this at all possible? It means that the fields in the main document must be placed into different cells according to the startdate of the dosage.

    Help will be greatly appreciated,

    Paul
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creaing custom calendar in mailmerge doc (word 9.0)

    I wouldn't use mailmerge for this, but use code to write the dosages into the correct cells.

  3. #3
    Lounger
    Join Date
    Jan 2006
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creaing custom calendar in mailmerge doc (word

    Hans,

    I use mail merg to fill in these forms, I can create fields using code, create a new document for every row in the excelsheet but have no idea how to link the fields to my excelsheet containing the data. So how do I connect?

    Thanks,

    Paul

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creaing custom calendar in mailmerge doc (word

    Your sample doc contains a macro with this line:

    .MailMerge.Fields.Add Range:=Selection.Range, Name:="Test"

    You'd have to do this in a loop and replace Test with the name of the appropriate mail merge field.

    Record a macro in Word of setting up the mail merge and connecting to the Excel data source. That will show you the code you need (involving ActiveDocument.MailMerge.OpenDataSource)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •