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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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,214,630
Messages
6,120,634
Members
448,973
Latest member
ChristineC

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