Reply
 
Thread Tools Display Modes
  #1   Report Post  
rutica rutica is offline
Junior Member
 
Posts: 14
Default mail merge dialog boxes

Hi,
I have a 2003 Word document that contains Mail Merge fields from an Excel document.

I am trying to make 2 buttons in Word.
-A button that opens the "Open Data Source" dialog box. (I will let the users browse to where they save the Excel file).
-A button that opens the "Mail Merge Recipients" dialog box. (I will let the user choose the recipients).

I was able to run a macro to get the code for the third button I need: a button that launchs the "Merge to New Document".

Is it also possible to delete those 3 buttons once the New document is created? The New document doesn't need the buttons, only the main mail merge document.

Also, I was trying to protect my mail merge document, but when I go to Tools, Protect Document, everything is grayed out.

Help!

Thanks,
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default mail merge dialog boxes

Why not just display the mailmerge toolbar. It contains those three buttons
among others.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"rutica" wrote in message
...

Hi,
I have a 2003 Word document that contains Mail Merge fields from an
Excel document.

I am trying to make 2 buttons in Word.
-A button that opens the "Open Data Source" dialog box. (I will let the
users browse to where they save the Excel file).
-A button that opens the "Mail Merge Recipients" dialog box. (I will
let the user choose the recipients).

I was able to run a macro to get the code for the third button I need:
a button that launchs the "Merge to New Document".

Is it also possible to delete those 3 buttons once the New document is
created? The New document doesn't need the buttons, only the main mail
merge document.

Also, I was trying to protect my mail merge document, but when I go to
Tools, Protect Document, everything is grayed out.

Help!

Thanks,




--
rutica


  #3   Report Post  
rutica rutica is offline
Junior Member
 
Posts: 14
Default

Thanks for writing.

The Mail Merge toolbar buttons are kind of hard to see and not very obvious.

Through trial and error and reading other internet posts, this is what I have for my button 1 (Open Data Source):

Private Sub cmdSelectDataSource_Click()
'select data source-step 1
Dim DataDoc As String
Dim MergeDoc As Document

Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.Title = "Select data source and click OK"
.InitialFileName = "Rpt- Governance Reporting Projects.xls"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
.Filters.Clear
.Filters.Add "Excel", "*.xl*", 1
If .Show -1 Then
MsgBox "Cancelled By User", , Title
Exit Sub
End If
DataDoc = fDialog.SelectedItems.Item(1)
End With
ActiveDocument.MailMerge.OpenDataSource Name:=DataDoc, ConfirmConversions:=False, Format:=wdOpenFormatAuto, Connection:="Entire Spreadsheet", SubType:=wdMergeSubTypeWord2000
End Sub

This is what I have for button 3 (Merge New Document)
Private Sub cmdMergeDocument_Click()
'merge document-step 3
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
Me.cmdSelectDataSource.Enabled = False
Me.cmdMergeDocument.Enabled = False
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
Me.cmdSelectDataSource.Enabled = True
Me.cmdMergeDocument.Enabled = True
End Sub

I don't know how to hide the command buttons, but I disabled them.

So I still need help with creating a button to open the Choose Recipients dialog box. Also,I still need help with protecting the form.

Thanks!

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge Mystery Dialog Box Anita, MOS Master Instructor XP Mailmerge 1 April 7th 07 06:32 AM
Automated Mail Merge Displaying unwanted Dialog Boxes ksg Mailmerge 8 January 14th 07 03:13 PM
mail merge dialog box SteveMargolis Microsoft Word Help 0 June 1st 06 05:02 PM
removal of sql dialog box during mail merge Kimberly Frieder Mailmerge 1 January 17th 06 05:07 AM
Mail Merge - Empty Microsoft Word Dialog box CD Mailmerge 1 June 15th 05 11:14 AM


All times are GMT +1. The time now is 10:52 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"