Shell function to open a specific word document (1 Viewer)

Leo_Polla_Psemata

Registered User.
Local time
Today, 01:42
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:42
Joined
May 7, 2009
Messages
19,243
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:

Leo_Polla_Psemata

Registered User.
Local time
Today, 01:42
Joined
Mar 24, 2014
Messages
364
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
 

spaLOGICng

Member
Local time
Today, 01:42
Joined
Jul 27, 2012
Messages
127
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

Top Bottom