Hiya, whnever I use this code, I get a File Not Found exception, even though the file paths are all correct. Any ideas? thanks

Dim WordReader As String = "C:\Program Files\Microsoft Office\Office10\WINWORD.exe"
Dim HelpPath As String = "C:\Documents and Settings\Steven\Desktop\TPBData\Help.doc"
        
        Shell(WordReader & HelpPath & "" & AppWinStyle.MaximizedFocus)

Recommended Answers

All 3 Replies

I tried it on my computer and got the same result file not found. This works:

Dim Proc As Process = System.Diagnostics.Process.Start(HelpPath)

I tried it on my computer and got the same result file not found. This works:

Dim Proc As Process = System.Diagnostics.Process.Start(HelpPath)

That's great! Works fine, and now the program doesn't need to specify the program filepaths. Thanks a lot

Got it, You need quotes around the two paths ....

Dim WordReader As String = Chr(34) & "C:\Program Files\Microsoft Office\Office10\WINWORD.exe " & Chr(34)
Dim HelpPath As String = Chr(34) & "C:\Documents and Settings\Steven\Desktop\TPBData\Help.doc" & Chr(34) 
Dim r As Integer = shell(WordReader & HelpPath, AppWinStyle.MaximizedFocus)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.