Results 1 to 15 of 15

Thread: How to create an 'Internet Explorer' Object using Webbrowser control

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    16

    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

  2. #2
    Member
    Join Date
    Sep 2004
    Posts
    32

    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

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    16

    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?

  4. #4
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    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:
    1. Dim objIE As InternetExplorer
    2. Set objIE = New InternetExplorer
    3.  
    4. objIE.Visible = True
    5. objIE.Navigate2 "http://www.vbforums.com"
    6.  
    7. Do While objIE.Busy = True
    8.     DoEvents
    9. Loop
    10.  
    11. MsgBox objIE.Document.URL
    12.  
    13. Set objIE = Nothing
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  5. #5
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    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?
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    16

    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

  7. #7
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    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.
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  8. #8
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: How to create an 'Internet Explorer' Object using Webbrowser control

    Sorry, forgot that. It's 'Microsoft Internet Controls'; no other components are necessary.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  9. #9
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    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?
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    16

    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

  11. #11
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Re: How to create an 'Internet Explorer' Object using Webbrowser control

    Yep. The same thing happened when I tried it?
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  12. #12
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: How to create an 'Internet Explorer' Object using Webbrowser control

    Here's the project I used; this works for me...
    Attached Files Attached Files
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    16

    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

  14. #14
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    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!!
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  15. #15
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    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.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width