Link to home
Start Free TrialLog in
Avatar of oostwijk
oostwijk

asked on

simple question

how can I load an html page named help.html in a browser window when I press a button named Help_btn in my visual basic program ?
Avatar of R_Rajesh
R_Rajesh

try:

Ret& = ShellExecute(0, "open", "c:\help.htm", "", vbNull, SW_SHOWNORMAL)
or
Ret& = ShellExecute(0, "open", "www.google.com", "", vbNull, SW_SHOWNORMAL)
Private Sub Help_btn_Click()
Ret& = ShellExecute(0, "open", "www.google.com", "", vbNull, SW_SHOWNORMAL)
End Sub

Rajesh
ASKER CERTIFIED SOLUTION
Avatar of R_Rajesh
R_Rajesh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of oostwijk

ASKER

Hi Rajesh,

It works fine when I use the line :
Ret& = ShellExecute(0, "open", "www.google.com", "", vbNull, SW_SHOWNORMAL)

However when I want to open a offline html page with:
Ret& = ShellExecute(0, "open", "help.html", "", vbNull, SW_SHOWNORMAL)
it doesn't work..

Can you help me out ?

give the full path:

Ret& = ShellExecute(0, "open", "c:\html\help.html", "", vbNull, SW_SHOWNORMAL)



Rajesh
Maybe you have to use the file protocol , like this
Ret& = ShellExecute(0, "open", "file://c:\html\help.html", "", vbNull, SW_SHOWNORMAL)

If you prefer to have programmatic control over the process rather than just shelling out (so that you can get better error information, for example), you could do this instead:

    Dim oIE As Object
   
    Set oIE = CreateObject("SHDocVw.InternetExplorer")
   
    oIE.Visible = True
   
    oIE.Navigate "http://www.sysinternals.com/"
   
    Set oIE = Nothing

If you prefer to use early binding, the TypeLib to Reference in VB is called "Microsoft Internet Controls".