Hi,

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

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

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

What=B4s the solution?

/ Ulf

Re: Open files in another program, like pdf, xls or ppt by Word

Word
Fri Jul 04 23:17:17 CDT 2003

G'day "Ulf Nilsson" <ulfnil@swipnet.se>,

activedocument.followhyperlink blah de blah


"Ulf Nilsson" <ulfnil@swipnet.se> was spinning this yarn:

>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: word_heretic@yahoo.com.au
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.

Re: Open files in another program, like pdf, xls or ppt by Ulf

Ulf
Mon Jul 07 00:52:09 CDT 2003

Thanks Steve,

So easy it is when one knows....

/ Ulf

>-----Original Message-----
>G'day "Ulf Nilsson" <ulfnil@swipnet.se>,
>
>activedocument.followhyperlink blah de blah
>
>
> "Ulf Nilsson" <ulfnil@swipnet.se> was spinning this=20
yarn:
>
>>Hi,
>>
>>How do I open a pdf-file using VBA? The name can vary.
>>
>>Following code works:
>>Dim RetVal
>>RetVal =3D Shell("C:\\Adobe\Acrobat 5.0
\Acrobat\Acrobat.exe=20
>>c:\test\123.pdf", vbMaximizedFocus)
>>
>>Follwing code does not work:
>>Dim RetVal
>>Const fPDF =3D "C:\Test\123.pdf"
>>RetVal =3D Shell("C:\\Adobe\Acrobat 5.0
\Acrobat\Acrobat.exe=20
>>fPDF", vbMaximizedFocus)
>>
>>What=B4s the solution?
>>
>>/ Ulf
>
>Steve Hudson
>
>Word Heretic, Sydney, Australia=20
>Tricky stuff with Word or words for you.
>Email: word_heretic@yahoo.com.au =20
>Products: =20
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.
>.
>