MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Open Acrobat from Excel 95


Posted by George Crowley on November 09, 2000 9:00 AM

I am creating a PDF output file from Excel. I want to add a macro to fire off Acrobat and display the file so the user can validate the output. I tried this:

Sub Verify_PDF()
Dim x As Application
x = Shell("C:\Program Files\Adobe\Acrobat 4.0\Acrobat\Acrobat.exe", 1)
With x
.Open ("C:\myPDF.df")
End With
Set x = Nothing
End Sub

but keep getting a Object variable not Set (Error 91) error. Any Hint's


Posted by Tim Francis-Wright on November 09, 2000 9:07 AM

Instead of
x = Shell ( ...
use
Set x = Shell ( ...

Posted by George Crowley on November 09, 2000 9:26 AM

Now I get a 'Type Mismatch'

Dim x As Application
Set x = Shell("C:\Program Files\Adobe\Acrobat 4.0\Acrobat\Acrobat.exe", 1)
With x
.Open ("C:\myPDF.pdf")
End With
Set x = Nothing

Posted by Tim Francis-Wright on November 09, 2000 11:18 AM


Serves me right for answering w/o testing first.
Fortunately, you can specify the file on the
Acrobat command line.

Sub macro()
Dim x
x = Shell("C:\Program Files\Adobe\Acrobat 4.0\Acrobat\Acrobat.exe c:\mypdf.pdf", 1)

End Sub

If you need to send commands to acrobat, check
Ivan's recent answer, which used the Wait method
and the SendKeys command.

5696.html

Posted by George Crowley on November 09, 2000 1:17 PM

Thanks So Much Tim!!

That did the trick for me.