How to create an 'Internet Explorer' Object using Webbrowser control
Hi there,
I want to use the webbrowser control to launch an internet explorer object from a VB6 form, then control it...
I really don't know how to do it.. I tried many things like below after adding the 'MS Internet controls library' :
Set moIE = New InternetExplorer
... or ...
Dim MyBrowser As SHDocVw.InternetExplorer
Set MyBrowser = New SHDocVw.InternetExplorer
And it doesn't work... help please ;)
Sirius
Re: How to create an 'Internet Explorer' Object using Webbrowser control
hi
all you need is one line, first draw a square using the webbroswer tool and put the code in form load or put it into a command button
obviously you can replace the text inside the "" by a text box ie text1
WebBrowser1.Navigate ("http://www.yahoo.com")
hope this helps
also using the keywords of webbrowser such as "GOFORWARD,GOBACK" etc etc you can link them to command buttons
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Thx for your answer... I should have precised that I don't want to use directly the object webcontrol ;) on the following web page http://www.vbwm.com/art_2000/masterie1_1.asp , a guy says that, using the "MS Internet control" library, it is possible to either use the webcontrol like you told me, or launch an Internet Explorer instance and that's what I need here... do you see?
Re: How to create an 'Internet Explorer' Object using Webbrowser control
You were close with your code. :) After the InternetExplorer object has been instantiated, it behaves the same way as the Web Browser control. Use this code, for example:
VB Code:
Dim objIE As InternetExplorer
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Navigate2 "http://www.vbforums.com"
Do While objIE.Busy = True
DoEvents
Loop
MsgBox objIE.Document.URL
Set objIE = Nothing
Re: How to create an 'Internet Explorer' Object using Webbrowser control
TheVader: What referenes would you need to set to use your code?
Other than the WebBrowser, are there any other controls that would need to be added to the form?
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Thx for your answer!
In fact, I've done it using the following code because when I use yours, I get an error message "Type is not defined" everytime I use "As InternetExplorer"... do you know why?
Dim MyBrowser
Set MyBrowser = CreateObject("InternetExplorer.application")
MyBrowser.AddressBar = False
MyBrowser.MenuBar = False
MyBrowser.Navigate ("http://www.yahoo.fr")
MyBrowser.Visible = True
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Quote:
Originally Posted by siriusb
Thx for your answer!
In fact, I've done it using the following code because when I use yours, I get an error message "Type is not defined" everytime I use "As InternetExplorer"... do you know why?
Dim MyBrowser
Set MyBrowser = CreateObject("InternetExplorer.application")
MyBrowser.AddressBar = False
MyBrowser.MenuBar = False
MyBrowser.Navigate ("http://www.yahoo.fr")
MyBrowser.Visible = True
Yes, I know, but I don't know how to fix it, which was the purpose of my last post. You need to add a reference to your project that will enable your project to recognize the Type Internet Explorer. I just don't know what that reference is.
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Sorry, forgot that. It's 'Microsoft Internet Controls'; no other components are necessary. :)
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Quote:
Originally Posted by TheVader
Sorry, forgot that. It's 'Microsoft Internet Controls'; no other components are necessary. :)
Ok. So all I would need is the component, no reference, correct?
Re: How to create an 'Internet Explorer' Object using Webbrowser control
I've added the "MS Internet Control" library and I still have problems:
Error code 430
" the class doesn't manage Automation or interface" (I've translated from french)
I've just done a copy and paste of your code in the load form + added the library, is there something else to do?
==================================
Private Sub Form_Load()
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Navigate2 "http://www.vbforums.com"
Do While objIE.Busy = True
DoEvents
Loop
MsgBox objIE.Document.URL
Set objIE = Nothing
End Sub
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Yep. The same thing happened when I tried it? :confused: :(
1 Attachment(s)
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Here's the project I used; this works for me... :confused:
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Ok got it! I've added "MS Internet COntrols" as a component and not as a reference! It works fine now! thx a million, that's very nice helping us on this!
Have a nice day
Re: How to create an 'Internet Explorer' Object using Webbrowser control
Quote:
Originally Posted by siriusb
Ok got it! I've added "MS Internet COntrols" as a component and not as a reference! It works fine now! thx a million, that's very nice helping us on this!
Have a nice day
Yep. Me too. I had it added as a component. Once I added it as a reference, it worked like a champ. Thanks TheVader!!
Re: How to create an 'Internet Explorer' Object using Webbrowser control
You're welcome. :) For more info on using IE/WB, read the articles in my sig.