Shell function to open a specific word document

Leo_Polla_Psemata

Registered User.
Local time
Today, 15:46
Joined
Mar 24, 2014
Messages
364
Hi
I need to open a specific word document from a form.
I have created a command button with the below bit of code but
i get run time error 53 , file not found

When i repeat same function using notepad.exe , then the txt file opens without error.


Code:
Private Sub Command67_Click()
        Shell "Word.exe G:\F IIDS LETTER\testone.docx", vbNormalFocus
End Sub
 
can you use Application.FollowHyperlink?

Application.FollowHyperlink "G:\F IIDS LETTER\testone.docx"


Or

Dim sFile As String
sFile = "G:\F IIDS LETTER\testone.docx"
CreateObject("Shell.Application").Namespace(0).ParseName(sFile).InvokeVerb "Open"
 
Last edited:
can you use Application.FollowHyperlink?

Application.FollowHyperlink "G:\F IIDS LETTER\testone.docx"


Or

Dim sFile As String
sFile = "G:\F IIDS LETTER\testone.docx"
CreateObject("Shell.Application").Namespace(0).ParseName(sFile).InvokeVerb "Open"

Thanks, could we use dlookup statement ?
Application.FollowHyperlink and then dlookup ?

This is because my file contains some Chinese characters and if i paste in va editor, i get ???

G:\F IIDS LETTER\Temp_Long Term 免费用箱申请表_1.doc
 
Hi
I need to open a specific word document from a form.
I have created a command button with the below bit of code but
i get run time error 53 , file not found

When i repeat same function using notepad.exe , then the txt file opens without error.


Code:
Private Sub Command67_Click()
        Shell "Word.exe G:\F IIDS LETTER\testone.docx", vbNormalFocus
End Sub


Use the Application.FollowHyperlink method instead.
 

Users who are viewing this thread

Back
Top Bottom