can excel vba respond to popup question-boxes loading word

StrawS

Board Regular
Joined
Jul 31, 2006
Messages
123
Hi,
I have set up several mail-merge documents in word that gather their information from an excel spreadsheet.

I am trying to build a userform with a button for each of these mail-merge documents - automating the process.

The macro behind each button will need to:
  • open the mail-merging word document
    answer yes to the popup prompt regarding running the sql command that filters the recipients ("yes" is not the default answer on this popup window).
    initiate the merge-to-document function (answering another prompt with the default answer)
    close the mail-merge document (leaving the new document open)

the part I am stumped on is this:
how do you get an excel macro to respond to a popup prompt in word.

I would *really* appreciate any help on this one.

Thanks for reading this through at least.
Straws
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi
I have just copied the following from VBA help - it may be what you need, although controllong SendKeys can be problematic.

Dim ReturnValue, I
ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
AppActivate ReturnValue ' Activate the Calculator.
For I = 1 To 100 ' Set up counting loop.
SendKeys I & "{+}", True ' Send keystrokes to Calculator
Next I ' to add each value of I.
SendKeys "=", True ' Get grand total.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.

Wolfshead
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,834
Members
449,192
Latest member
mcgeeaudrey

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