mail merge

oleg_v

Board Regular
Joined
Sep 15, 2009
Messages
164
hi

i need a macro to activate the refresh button in ms word mail merge recipients window.


thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi oleg,


Which version of Word? What exactly are you trying to refresh? What have you coded so far and what are you having trouble with?
 
Upvote 0
hi
i have 2003 word version.

i have no code because i am new in this.

i will appreciate if you will help me.

Thanks
Oleg
 
Upvote 0
Hi oleg,

You haven't answered the second question. Without knowing what you're trying to achieve, and why you need to do this through vba (your reply suggests it's not part of a larger vba project), it's hard to understand the requirement.
 
Upvote 0
HI
It is not a part af a project.
i have a word file that merged to excel file.

the data in excel is added automaticaly every 2 hours.

when i want to find data with the word merged file i can not see the last added data if i do not do refresh in mail merge recipients window.

only then i can pull fron excel file the last added data.

i am just want to do this auttomaticaly when the word file opens.
 
Upvote 0
Hi oleg,

i am just want to do this auttomaticaly when the word file opens
But that is how it already works - when you open a Word mailmerge main document, it loads the Excel file with the most recent updates to the data. Keeping the mailmerge main document open while the Excel file is being updated is risky - it could result in data loss. Is there a reason you can't close the mailmerge main document when it's not actually being used to generate a mailmerge?
 
Upvote 0
hi

i tried this several times and the mail merge mail word ducument is daes not see the recent data that added to excel without refresh.

the main document is always closed.
i have a macro to bring the mail merge recipients window when it is ativated i just can not make it to press the refresh button
it daes work in ather ways anly with refresh.

Sub oj()


Dim dlgMailMergeMRecipients As Dialog
Set dlgMailMergeMRecipients = Dialogs(wdDialogMailMergeRecipients)
dlgMailMergeMRecipients.Display
Set dlgMailMergeMRecipies = Nothing

ActiveDocument.MailMerge.DataSource.QueryString = Activate





End Sub
 
Upvote 0
Hi oleg,

Is the Excel file closed when you start a mailmerge session (ie the mailmerge session opens the Excel file)? It seems to me there's definitely something awry with whatever you're doing since, as I said in my previous post, Word should automatically get the latest updates. The only reason I can see for it not doing so is if the Excel file is already open.
 
Upvote 0
Hi oleg,

You may be able to use:
Code:
Sub oj()
With Dialogs(wdDialogMailMergeRecipients)
  .Update
  .Execute
End With
End Sub
Your line:
ActiveDocument.MailMerge.DataSource.QueryString = Activate
should throw an error. Changing it to:
strQry = ActiveDocument.MailMerge.DataSource.QueryString
wouldn't (provided strQry is dim'd) but I can't see that it would do anything useful.
 
Upvote 0

Forum statistics

Threads
1,225,462
Messages
6,185,129
Members
453,279
Latest member
MelissaOsborne

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top