Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping Macro versus Pausing

Status
Not open for further replies.

Bass71

MIS
Jun 21, 2001
79
Hi:

I'm am using the SendKey functionality to launch Excel attachments from Lotus Notes. Unless the last line of code is the launching of attachment, the spreadsheet does not open. It doesn't matter how long a pause I put in, the actual opening of the file doesn't happen if there's code after. So, I am seeking a way to stop the macro and then resume, with the hope that this will solve my dilemma.

Here's what I have before the problem:

SendKeys "L", True --This launches the attachment
Application.Wait Now() + TimeSerial(0, 0, 4)
SendKeys "^{p}", True --This initiates printing, but due to the code after the launch it never opens.

THanks for your help..................RO
 
Bass71,

I think you need to use the
Code:
DoEvents
command which will pass control to your Operating System, allow it to perform the tasks it needs to do i.e. open your attachements, then return control to your code.

So you will have;

Code:
 Your Code to open the attachement.

DoEvents

Your Code following the attachment opens

Check out the VBA help files for DoEvents also.

Hope this helps.

Leigh Moore
Solutions 4 MS Office Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top