How can I write a VB code to open a file say pdf document

J

Jim/Chris

Her is a function

Function runapp()
On Error GoTo runapp_Err

Call Shell("Path to PDF App" "Path to document""", 1)

runapp_Exit:
Exit Function

runapp_Err:
MsgBox Error$
Resume runapp_Exit

End Function

Jim
 
N

new.microsoft.com

Hi Jim,

I have keyed in this statement, it has "Run time error 53" which states
"File not Found"

Call Shell("C:\Program Files\Adobe\Acrobat
5.0\Acrobat\acrobat.exe""C:\grade.pdf""", 1)

can you help?
Thanks again
 
M

Mingqing Cheng [MSFT]

Hi,

Thanks Jim for his great answer!

From Jim's suggestions, the following codes runs well on my machine.

Private Sub Command0_Click()
Call Shell("c:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe
c:\a.pdf", 1)
End Sub

Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are here to be of assistance!


Sincerely yours,

Mingqing Cheng
Microsoft Developer Community Support
 

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