Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open HTML file

Status
Not open for further replies.

sochidog

Technical User
Jun 26, 2003
22
CA
I have a vb app that opens a pre-made html file on a shared drive. I think the shared drive doesnt like the line...

Dim FileToRun As String
FileToRun = CurDir & "\XYZ.html"
Shell ("cmd /c " + Chr(34) + FileToRun + Chr(34))

Is there an alternate way to open the html file without using the cmd object?



 
You can use the ShellExecute API:

In Declarations section
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

In Code
Public Sub OpenThisDoc(formname As Long, FileName As String)
Dim x As Long
x = ShellExecute(formname, "Open", FileName, 0&, 0&, 3)
End Sub


Or you can shell to RUNDLL:
Public Sub OpenDocument(DocumentWithPath As String)
Shell "RUNDLL32.EXE URL.DLL, FileProtocolHandler " & DocumentWithPath, vbNormalFocus
End Sub

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top