Opening a Word and/or PDF document from Excel

V

Vikesh Jain

I want to write a macro which on execution opens a file (Word document
/ PDF - in their respective applications) which is stored at a
specified path on my system. Can somebody provide me a vba code for
doing the same?
 
P

Paul B

Vikesh, here is one way,

Sub OpenFiles()
Dim sPath As String
sPath = "C:\My Documents\"
With ThisWorkbook
.FollowHyperlink sPath & "test.pdf"
.FollowHyperlink sPath & "test.doc"
End With
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 

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