Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Hi,
I'm writing some VBA to complete a mailmerge and have got it working more or less as I want it. I'm looping around the DataSource, incrementally setting the .FirstRecord and .LastRecord With ActiveDocument.MailMerge .Destination = wdSendToNewDocument .SuppressBlankLines = True With .DataSource .FirstRecord = intCurr .LastRecord = intCurr End With .Execute Pause:=False When the .Execute line is executed, then it opens up the new mailmerged document, which makes that the active document. At that point, (vba wise), I'm in the new document and don't have access to the (original) Mailmerge.Datasource I want to access some fields within that .DataSource. However, when I (programatically) save the mailmerged document, and return to the originating document, the .DataSource record has moved back to the 1st record rather than the record I've just processed (which is the record number in the intCurr variable). So, if intCurr = 3, the ActiveDocument.MailMerge.Execute merges the 3rd record in, but when I save the document (with the 3rd record's information in it), and return to the originating document, it doesn't show the 3rd records information, but the 1st. Can I navigate to the nth (e.g. 3rd or 4th record) in a .DataSource before the .Execute method runs. Apologies if my explanation is confusing. |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mailmerge: First Record in stead of Next Record | Mailmerge | |||
XML as a MailMerge datasource | Mailmerge | |||
Mailmerge from Excel Datasource | Mailmerge | |||
How to Close original Document after executing MailMerge. | Mailmerge | |||
Mailmerge datasource | Mailmerge |