getting excel to wait

hainejo

Board Regular
Joined
Jun 27, 2002
Messages
57
I have a macro that prints an excel worksheet as a post script file and saves it to a folder on the server. The file is then converted by Acrobat Distiller into a PDF file and saved into another folder. The macro then tells Outlook to create an e-mail and attach the PDF file. The problem is that the macro executes to fast. It looks to attach the PDF file before Distiller can create it. Is there a way to slow the macro down? I have tried the application.wait command but I don't know how to define the amount of time it should wait. Can anyone help me?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You can use the Dir function in a loop to wait until the file has been created:

Code:
x = Dir("YourNewFile") ' Change name to include Path
If x = "" Then
   Do
      x = Dir()
      DoEvents
   Loop While Dir = ""
End If
 
Upvote 0
I am getting an error on the line
'x = Dir()'
I am getting Invalid procedure call or argument.
 
Upvote 0

Forum statistics

Threads
1,215,332
Messages
6,124,314
Members
449,153
Latest member
JazzSingerNL

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