Problems with Inet Control in VB

I am fairly new to visual basic and this forum, so I apologize if this turns out to be a REALLY simple error.

I have been trying to make a web scraper and parse it into an Access Database. I wanted to use the Inet control however cannot seem to get it to work. (I get an Error 91 every time)  I have added the msinet.ocx file to the references and have googled every which way to write the code with no avail.

I was hoping someone here might have an Idea to help me out.
Who is Participating?
c0ldfyr3 is correct, I was mixing up the WebBrowser control with the msinet control.

I just tried c0ldfyr3's original code and it worked fine on my machine, but, I don't think I have sp4.

You could try selecting the Microsoft Internet Controls to place on the toolbar... mine is right above the Internet Transfer Control in the list.  Then, select the globe as mentioned above... that would create an instance something like


Your code would look like:

Dim sHTML as String

WebBrowser1.Navigate ""

Do While WebBrowser1.Busy

sHTML = WebBrowser1.Document.Body.innerText
MsgBox sHTML

If that doesn't work, I'll try to dig up my other HTTP code for you.
You must not be too familiar with google o.O

Google "microsoft internet transfer control access" first result is

Option Compare Database
Dim objInet As Inet
Private Sub Form_Load()
    Set objInet = Inet0.Object
    Dim sHTML As String
    ' Set the internet transfer control protocol and URL.
    objInet.Protocol = icHTTP
    objInet.URL = "HTTP://"
    ' Retrieve the HTML data into a byte array.
    sHTML = objInet.OpenURL(objInet.URL, icString)
    MsgBox sHTML
End Sub

Open in new window

Can you show any code that you've tried?  It is easier for us than starting from scratch.

Basically, you wouldn't add the OCX to the references, but rather, you would drag it off the tool bar and place it on your form.  I think the icon looks like a little globe.  If you don't see it on your toolbar, then right-click the toolbar and select Add Components from the popup menu, then browse to where your msinet.ocx control is, select it and it should appear on your toolbar.

Once you drag it to your form, it is like a little browser window.  Then, in your code, let's say the instance of the inet you put on your form was named iNet1, you would code something like:

iNet1.Nagivate ""

Now, it takes a little while for the iNet1 control to get the contents of the web page, so, you might want to wait until you see the results on the form before trying to do your scraping.

When you're ready to parse the HTML, I believe the iNet1 control has a property called innerHTML or maybe Body... you might have to browse through the properties to find the likely one (it's pretty obvious).  That is a String that will contain all of the HTML retrieved from the web page.

That's about all there is to it!
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Brattlof54Author Commented:
I think I narrowed down the problem. I tried mdougan's method and I think the problem seems to be with my license, and sadly I cannot justify the cost to upgrade.  Is there another way to get the source code?
A problem with your VB6 license?

If there is an issue with your msinet.ocx, I believe that I have some sample code for making HTTP requests that do not use that OCX (though, I'll have to review what it does use).

If your problem is with the VB6 license, then, I don't know you mean by "is there another way to get the source code."
Brattlof54Author Commented:
Sorry about the delay on getting back to you.

But the problem is not with my VB6 (From what I understand I can use everything else except msinet)

OK, well, please address the other posts?

It doesn't make much sense that you'd have trouble with msinet, unless you are behind some sort of firewall or proxy server.
mdougan, the control you speak about in your post is not msinet, msinetis a transfer only conrol and has no graphical interface in run time.It displays as a picture of a little world in a 48x48 box at designtime. The control you describe, and which has a Navigate function, isthe Microsoft Internet Conrol....

Author, can you please decribe why you think the issue is with yourlicense? If you follow mdougans method for adding the control to theform, and use the code from my first post it should work.

The difference between Access and VB6 seems to be that you need to use the .object property of the control  from  Acces to access the actualy Inet object.
Brattlof54Author Commented:
When I try to add the Microsoft Internet Transfer Control 6.0 SP4 a pop-up message opens with the prompt You dont have the license required to use this ActiveX control. You tried to open a form containing an OLE object or an ActiveX control or you tried to create an ActiveX control. To obtain the appropriate license, contact the company that provides the licensed OLE object or ActiveX control.

 I assume that the license is with the the msinet.
Brattlof54Author Commented:
Thank you for your help. I got everything working using the WebBrowser1.Document.Body method.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.