Browser Control

katdude used Ask the Experts™
In a recent project, I opend an html file by clicking on a button on one of my forms.

I used this and it works:
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

option explicit

Private Sub mnuFilePrintPreview_Click()

'The purpose is so reports can be printed.
             Dim stFile As String
                  stFile = "C:\TESTFILE.doc"
             ShellExecute Me.hwnd, "open", stFile, vbNullString, vbNullString, 2
End Sub

Now I am trying to acces a website using the same code as above, but It does not even open internet explorer.

What do I need to open an internet site by using a Click Event???
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I just write the following in the click event and it opens the default browser and navigates to the specified url ""

ShellExecute 0, "OPEN", "", "", "", 1

if nothing is happening try entering just the url, without the quotes, into the RUN box in your start menu. If still nothing happens then you got problem is not with the shellexecute statement
Otherwise u can use the Web Browse control to open the Web in VB window itself
The control name is Microsoft Internet control
Place the web browser in ur form
to open a page
webbrowser1.navigate ""
Good Luck
Author of the Year 2009

Hi katdude,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept SashiJanahan's comment(s) as an answer.

katdude, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial