simple question

Posted on 2003-12-06
Last Modified: 2010-04-17
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 ?
Question by:oostwijk
LVL 24

Expert Comment

ID: 9890839

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

Expert Comment

ID: 9890846
Private Sub Help_btn_Click()
Ret& = ShellExecute(0, "open", "", "", vbNull, SW_SHOWNORMAL)
End Sub

LVL 24

Accepted Solution

R_Rajesh earned 50 total points
ID: 9890866
well i forgot to list the function

Private 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

Private Sub Help_btn_Click()
Ret& = ShellExecute(0, "open", "", "", vbNull, SW_SHOWNORMAL)
End Sub
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!


Author Comment

ID: 9891809
Hi Rajesh,

It works fine when I use the line :
Ret& = ShellExecute(0, "open", "", "", 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 ?

LVL 24

Expert Comment

ID: 9891812
give the full path:

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


Expert Comment

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


Expert Comment

ID: 9915030
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 ""
    Set oIE = Nothing

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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
squareUp  challenge 22 105
count7 challenge 12 69
word0 challenge 3 56
Arduino EDI - Programming language 3 60
This article will show, step by step, how to integrate R code into a R Sweave document
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now