I
IComeInTheWest
Hello,
I am writing a macro that opens a workbook (say, MyWorkbook) and calls
a macro (say, MyMacro) from MyWorkbook. MyMacro displays a vbYesNo
message box in which I'd like to select "Yes" automatically.
One idea I was given (with a caveat of method-unreliability) was to
use the SendKeys Method as follows:
Application.SendKeys "{RETURN}"
Application.Run "MyWorkbook!MyMacro"
I tried this and it worked the first few times but has not worked the
previous few.
Why is the SendKeys Method so quirky?
Is there another, better way to automatically select "Yes" in a
message box which was called from another workbook?
Note: Editing the code in MyMacro is not an option.
Regards,
Calvin
I am writing a macro that opens a workbook (say, MyWorkbook) and calls
a macro (say, MyMacro) from MyWorkbook. MyMacro displays a vbYesNo
message box in which I'd like to select "Yes" automatically.
One idea I was given (with a caveat of method-unreliability) was to
use the SendKeys Method as follows:
Application.SendKeys "{RETURN}"
Application.Run "MyWorkbook!MyMacro"
I tried this and it worked the first few times but has not worked the
previous few.
Why is the SendKeys Method so quirky?
Is there another, better way to automatically select "Yes" in a
message box which was called from another workbook?
Note: Editing the code in MyMacro is not an option.
Regards,
Calvin