Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-03-2015, 12:30 PM
spc94 spc94 is offline Mail Merge Macro Windows 7 64bit Mail Merge Macro Office 2010 64bit
Novice
Mail Merge Macro
 
Join Date: Jun 2015
Location: Ohio, USA
Posts: 8
spc94 is on a distinguished road
Default Mail Merge Macro

I want to open a template that I have in word and it when it opens a message box appears and asks me to select recipients (excel file) for mail merging. After that I want another message box to appear that asks me to find recipients. Any Suggestions?
Reply With Quote
  #2  
Old 06-03-2015, 09:51 PM
gmayor's Avatar
gmayor gmayor is offline Mail Merge Macro Windows 7 64bit Mail Merge Macro Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Add the following code to the template
Code:
Option Explicit

Sub AutoNew()
    Dialogs(wdDialogMailMergeSetDocumentType).Show
    If ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument Then
        MsgBox "No a merge document!"
        GoTo lbl_Exit
    End If
    Dialogs(wdDialogMailMergeOpenDataSource).Show
    Dialogs(wdDialogMailMergeRecipients).Show
lbl_Exit:
    Exit Sub
End Sub
Then create a new document from it.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 06-04-2015, 07:06 AM
ch1325 ch1325 is offline Mail Merge Macro Windows 7 64bit Mail Merge Macro Office 2013
Novice
 
Join Date: Jun 2015
Location: Montana
Posts: 12
ch1325 is on a distinguished road
Smile

This code actually partially helps me out! Thank you,

Is there a way to Finish and merge All Records after this is ran? Would be nice to just auto-open the new document after this macro is used.

Another issue I had was trying to put this into my Custom Ribbon and it keeps giving me "Argument not optional" But when I manually select it to run under the developer tab it runs fine.
Reply With Quote
Reply

Tags
macros in word, mail merge, selecting recipients

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge Macro Mail Merge Macro ch1325 Word VBA 2 06-08-2015 06:18 AM
Help Please: New VBA user trying to use a macro to split Mail Merge documents. Two Run-Time Error zipit189 Word VBA 7 03-18-2015 01:13 PM
Macro to loop through all cells in a table produced by a mail merge elh52 Word VBA 4 08-31-2014 10:50 PM
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM
Mail Merge Macro Word Doc Macro (mail Merge) ajolson1964 Word VBA 1 05-10-2011 10:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:05 PM.


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