Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 12-05-2013, 02:22 PM
macropod's Avatar
macropod macropod is offline Code for mail merge to reference saved excel file Windows 7 32bit Code for mail merge to reference saved excel file 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

Quote:
Originally Posted by jtemp57 View Post
I ran it and it lets me choose my datasource, but I want it to remain with the current word document that has all the merge fields set. The code you gave me opens up a new document with no merge fields
No, that's not what's happening. The macro I provided retains all of the mergefields and other content of the document from which it is run. It doesn't simply open a new document. Rather, using the document containing the code, it executes the mailmerge using that document and its mergefields and that process generates a new document containing the mailmerge output.
Quote:
I deleted the .Destination and it works.
Not really; all you've done is killed off the output, which Word will now ask you to specify.
Quote:
Another issue is that it is asking me twice to choose my list from excel before moving on.
To fix that, delete:
.OpenDataSource sPath
Working through the dialog already connects once, so there's no need to do it again. My bad.
Quote:
I also have created a form with a button attached to the code below. How do I get the form to pop up with the Word Document so that I can run the code below?
Without knowing what kind of button, or how you propose to hide it when the output is generated, I can't really say. However, for a more automated approach, move the code to the document's 'ThisDocument' code module and rename it:
Private Sub Document_Open()
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
mail merge, vbs



Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for mail merge to reference saved excel file VB code: populate combobox from columns in Excel file billybeach Outlook 2 04-27-2013 04:38 AM
Mail Merge Code (Default Display) ochiha_ita Mail Merge 3 04-22-2013 04:04 AM
Code for mail merge to reference saved excel file Code to stop as "save as" if the mail merge has not been done tonywatsonmail Mail Merge 4 04-27-2012 01:57 AM
Mail Merge saved to single .pdf treetop Mail Merge 1 08-10-2011 03:28 PM
Mail merge Field Code Manipulation macjnr Mail Merge 0 09-10-2009 11:37 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:41 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft