Forum Discussion
Using Mail Merge with MACROS
Hello Jamony
I do not know how to address the next section to apply the MACRO. Although the resulting pdf occupied two pages addressing the second page using (an absolute setting for test purposes):
Selection.GoTo wdGoToPage, wdGoToAbsolute, 2
merely resulted in the MACRO applied to the 1st page again, which is what you suggested could happen
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdNextRecord - this worked interactively but would not work with the actual merge to create the document, as I presume merge would no longer be active then, and even then some changes from the previus page were carried over
I had two tables on a single page so I wondered if the merge would generate extra tables on the next page for the same document
Thus, I used:
ActiveDocument.Tables(1).Cell(index, 1).Select
To select the 1st cell in the table on the 1st page
I wondered if new Tables were created for subsequent pages in the same active document
when I ran
ActiveDocument.Tables(3).Cell(index, 1).Select
the table was not found
I tried to see if the SECTIONS property of ACTIVEDOCUMENT could be used
ActiveDocument.Sections.Count = 2
An attempt at using this to navigate resulted in an error applying an assignment to a read only property
I still seem to be trapped applieing my macro to the 1st page of the document
regards
I do not know how to address the next section to apply the MACRO. Although the resulting pdf occupied two pages addressing the second page using (an absolute setting for test purposes):
Selection.GoTo wdGoToPage, wdGoToAbsolute, 2
merely resulted in the MACRO applied to the 1st page again, which is what you suggested could happen
I still seem to be trapped applieing my macro to the 1st page of the document
It is important to distinguish between pages and sections. A letter merge will create at least one new section for each record, more if the primary merge document contains more than one section.
Page numbering is likely to restart with each newly created section break.