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

  • Thread starter Thread starter new.microsoft.com
  • Start date Start date
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
 
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
 
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
 
Back
Top