[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 454
  • Last Modified:

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
0
JoelRidley
Asked:
JoelRidley
  • 3
  • 2
1 Solution
 
p912sCommented:
Here's an articlke on using the Inet Control.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q163653


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.
0
 
p912sCommented:
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
   
    Do
        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
        Else
            Exit Do
        End If
    Loop
   
    Debug.Print "All done!"
End Sub
0
 
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
0
 
p912sCommented:
>>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....
0
 
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
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now