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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Open up a HTM file with VB

Status
Not open for further replies.

marcin2k

Programmer
Jan 26, 2005
62
CA
I want to be able to open up a HTM file in my internet explorer on a click of a command button. Lets say my path is "C:\test.htm"

Thanks for the help, its probably a one liner that i don't know about yet.
 
Code:
Private Sub Command0_Click()
    Dim strURL As String
    strURL = "C:\test.htm"
    Shell "C:\Program Files\Internet Explorer\iexplore.exe " & strURL, vbNormalFocus
End Sub
If you don't know the location Internet Explorer then use
[tt]
Shell "RUNDLL32.EXE URL.DLL,FileProtocolHandler " & strURL, vbNormalFocus
[/tt]

________________________________________________________
Zameer Abdulla
Help to find Missing people
There’s a world of difference between editorials and advertorials
 
Why not simply this ?
Application.FollowHyperlink "C:\test.htm"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV, [medal]

________________________________________________________
Zameer Abdulla
Help to find Missing people
There’s a world of difference between editorials and advertorials
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top