Thread Tools Display Modes
  #1   Report Post  
borntorun75 borntorun75 is offline
Junior Member
Posts: 1
Default VBA : navigating to the nth record of a .Datasource before executing the mailmerge


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.
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mailmerge: First Record in stead of Next Record Guus Mailmerge 6 February 6th 07 03:00 PM
XML as a MailMerge datasource Tim Turnquist Mailmerge 4 October 14th 06 06:29 AM
Mailmerge from Excel Datasource Jan Mailmerge 1 March 21st 06 07:39 PM
How to Close original Document after executing MailMerge. Don Mailmerge 1 January 14th 06 08:15 AM
Mailmerge datasource LuckyLady Mailmerge 1 September 2nd 05 06:26 PM

All times are GMT +1. The time now is 09:53 AM.

Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright 2004-2023 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.

About Us

"It's about Microsoft Word"