Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Mail Merge macro help - merging different docs with same database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Worksmart - 16 May 2008 21:41 GMT
I am not a programmer but I know how to record macros. I’m working in Word
2003. The code below will give you a chuckle to start your weekend.

Scenario: Users will click a Command Button in a Word document to merge the
same database with various documents that are already set up with merge
fields.

When they click the button, a message box “Are You Sure?” pops up in case
they clicked the box in error. After that, they are given the opportunity to
browse for the document they want to merge (database and merge fields already
in place). After that, I’d like them to be able to choose the recipients
because they will not always need to create a document for everyone. Then on
to complete the merge, creating new documents (so they can view before
printing).

Below is the code I have so far. It works until I browse to find the file.
Merge doesn’t happen, and I have no idea what to do about them choosing
recipients.

Can someone help with this? Thanks in advance.

Private Sub CommandButton4_Click()
' Events_TentCard Macro
' Macro recorded 5/11/2008 by Peggy Duncan
'
       If MsgBox(Prompt:="Are You Sure?", Buttons:=vbYesNo + vbQuestion, _
     Title:="Mail Merge Document") = vbNo Then
     Exit Sub
   End If
         
       Dialogs(wdDialogFileOpen).Show
       With ActiveDocument.MailMerge
       .Destination = wdSendToNewDocument
       .SuppressBlankLines = True
       With .DataSource
           .FirstRecord = wdDefaultFirstRecord
           .LastRecord = wdDefaultLastRecord
       End With
       .Execute Pause:=False
   End With
   '
  End Sub

Signature

Peggy Duncan, Author
Conquer Email Overload with Outlook
http://www.PeggyDuncan.com

Worksmart - 16 May 2008 23:40 GMT
UPDATE: The mail merge works. I had pasted the code to the wrong Command
Button.

The only thing I need help with now is giving the user the opportunity to
choose recipients for the merge.

Thanks in advance for any help.

Signature

Peggy Duncan, Author
Conquer Email Overload with Outlook
http://www.PeggyDuncan.com

> I am not a programmer but I know how to record macros. I’m working in Word
> 2003. The code below will give you a chuckle to start your weekend.
[quoted text clipped - 38 lines]
>     '
>    End Sub
Cindy M. - 22 May 2008 15:36 GMT
Hi =?Utf-8?B?V29ya3NtYXJ0?=,

> The only thing I need help with now is giving the user the opportunity to
> choose recipients for the merge.

Why not just display the built-in Word dialog box?
Dialogs(wdDialogMailMergeRecipients).Show

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
Worksmart - 22 May 2008 21:26 GMT
Hi Cindy, perfect! This is exactly what I needed. You guys are terrific.
Signature

Peggy Duncan, Author
Conquer Email Overload with Outlook
http://www.PeggyDuncan.com

> Hi =?Utf-8?B?V29ya3NtYXJ0?=,
>
[quoted text clipped - 11 lines]
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.