Thread: [Solved] Mail Merge keeping VBA Macro
View Single Post
 
Old 08-02-2015, 10:00 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Word has no setting that would enable a mailmerge main document's VBA code automatically to be added to the output documents; it has to be done post-merge. That can be done manually or programmatically (but that becomes a potential problem if the code to do so is in the module you want to export, since the export code also gets exported).

However, there may be some more fundamental problems you will need to address. You refer to using the code to "change text based on what has been selected". That suggests you're either using field coding or bookmarks to manage the text changes. Neither of these is likely to survive the mailmerge (some fields do, but those that do probably don't offer the scope for what you're trying to achieve).

Is there a reason your option selections can't be made part of the mailmerge (e.g. via field coding that tests various fields in the datasource, or use FILLIN or ASK fields as either the first record or each record is processed)?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote