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

How Do I Launch Internet Explorer?

Status
Not open for further replies.

seema165

Programmer
Jul 11, 2005
48
GB
Hi,

Does anybody know how I launch Internet Explorer using VB? I want to launch it and have it open on a specific URL.

Any help would be appreciated.

Thanks in advance
 
Project -> References...
find the "microsoft internet controls", check it and hit ok.

Then write this code:

Dim myInetExp As New InternetExplorer
myInetExp.Navigate "siteURL"
myInetExp.Visible = True


Thats all.
 
I have not confirmed this one but couldn't you use the SHELL command if you did not want to add more fat to your app. The shell command can open the IE executable.



Thank you for all your help

Tom
 
Shell "iexplore", <WindowState>

If it causes an error then:
Shell "iexplore.exe", <WindowState>
 
But you can't assign a url. It will load the home page. Else do what i said in my first post.
 
There is a response, in another thread, by ca8msm that shows how to open internet explorer in a seperate window.

thread222-696442

The meat of it is...
Shell "rundll32.exe url.dll,FileProtocolHandler
This will open the default browser (in case it's not internet explorer) with whatever page you want.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
>But you can't assign a url. It will load the home page. Else do what i said in my first post.
You can ...
[tt] "iexplore [/tt]
>...do what i [VBakias] said in my first post
It is in fact more satisfactory.
 
You can use the ShellExecute API as well.

Add the API declaration in a module.
Code:
'// API to call the default browser.
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

Place the following code in the correct event.
Code:
   Dim l_lngRetVal As Long
   Const SW_SHOWNORMAL = 1

   l_lngRetVal = ShellExecute(0&, vbNullString, "[URL unfurl="true"]www.tek-tips.com",[/URL] vbNullString, "C:\", SW_SHOWNORMAL)



zemp
 
I'm using VBakias's code as above, but I'm getting an error on line Dim myIntExpl As New InternetExplorer.
The error says User-defined type not defined.

I'm actually creating an ActiveX DLL project and not a Standard EXE project.

All I have is a form with a button on it and when the button is pressed I have the code as above within the button's procedure.

Please help

thanks
 
In the vb ide, click Project -> Component

Select Microsoft Internet Controls

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thanks all for your help.

I got it working now.
I used VBScript which is really simple.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top