VBA get html tag from html page

Hello Expert,
Using MSAccess how can I get thename of an image or images from the html page I am viewing and then save this image data to a table. I am creating a new webbrowser (IE6) from Access. Thank you, Joel
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Here's an articlke on using the Inet Control.


Once you have the page in a text documnet all you need to do is search for the IMG tags and parse out the data you're after.
Curisoity got the best of me... here's a short example that will pull all of the IMG tags from a page. Create a new form, place a comand button on it called cmdGetAsString and place this code in it's click event. And insert the Microsoft Internet Transfer Control from Insert - ActiveX Control on your form and you're all set to test.

Private Sub cmdGetAsString_Click()
    Dim strPage As String, x As Long, y As Long
    ' Set a reference to the internet transfer control.
    Set objInet = Me.Inet0.Object
    ' Set the internet transfer control protocol and URL.
    objInet.Protocol = icHTTP
    objInet.URL = "HTTP://www.msn.com"

    ' Retrieve the HTML data into a byte array.
    strPage = objInet.OpenURL(objInet.URL, icString)
    x = 1
        x = InStr(x, strPage, "<img src")
        If x <> 0 Then
            y = InStr(x + 5, strPage, ">")
            Debug.Print Mid(strPage, x, y - x + 1)
            x = x + 1
            Exit Do
        End If
    Debug.Print "All done!"
End Sub
JoelRidleyAuthor Commented:
p912s I thank you for the help but am unable in insert Inet. I use shddocdl.dll to start IE6. I should have explained better, the wife is always deleting her images and then redownloading them.Its an older laptop and I don't let her on my system after she crashed it. She is not to computer savvy, I just wanted to make a table of here favorites and then all shehas to do s click a button to save the ihnfo in a table
thanks, Joel
>>use shddocdl.dll to start IE6
Do you mean shdoclc.dll and not shddocdl.dll ? I'm not familiar with using this? The Internet Transfer Control is MSINET.OCX and can be used to transfer pages without viewing them. And the WebBrowser Control is part of the Microsoft Internet Controls SHDOCVW.DLL and can be used to view pages in Access.

>>always deleting her images and then redownloading them
>>just wanted to make a table of here favorites
How are these related? Favorites & images? An image of a page in history? A jpg or gif displayed on a page? How are favorites related to this?

As you can see I'm confused as to what you're problem is and what you're really trying to accomplish....

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JoelRidleyAuthor Commented:
What I want to do is when she is at a webpage with the images she wanys is to click a button on a form and that will gather all the image names and put them in a table which she can then later download. the only part I haven't worked out is getting the file names from the webpage thanks again Joel
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

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.