Open files in another program, like pdf, xls or ppt

U

Ulf Nilsson

Hi,

How do I open a pdf-file using VBA? The name can vary.

Following code works:
Dim RetVal
RetVal = Shell("C:\\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe
c:\test\123.pdf", vbMaximizedFocus)

Follwing code does not work:
Dim RetVal
Const fPDF = "C:\Test\123.pdf"
RetVal = Shell("C:\\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe
fPDF", vbMaximizedFocus)

What´s the solution?

/ Ulf
 
W

Word Heretic

G'day "Ulf Nilsson" <[email protected]>,

activedocument.followhyperlink blah de blah


Ulf Nilsson said:
Hi,

How do I open a pdf-file using VBA? The name can vary.

Following code works:
Dim RetVal
RetVal = Shell("C:\\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe
c:\test\123.pdf", vbMaximizedFocus)

Follwing code does not work:
Dim RetVal
Const fPDF = "C:\Test\123.pdf"
RetVal = Shell("C:\\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe
fPDF", vbMaximizedFocus)

What´s the solution?

/ Ulf

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email: (e-mail address removed)
Products: http://www.geocities.com/word_heretic/products.html
Spellbooks: 728 pages of dump left and dropping...

The VBA Beginner's Spellbook: For all VBA users.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top