Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    IE Object Model (from Access/VBA)

    Does anybody have a good reference that covers the IE Object Model that I can use to scrape data feom Web pages and put it into Access tables.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: IE Object Model (from Access/VBA)

    Note to all: if you know of any good resources on the W3C standard Document Object Model (DOM), that probably would also help Pat (even if it doesn't have all of the proprietary Microsoft extensions).

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: IE Object Model (from Access/VBA)

    Hi Jefferson
    Where did you learn about the IE Object Model?

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: IE Object Model (from Access/VBA)

    VBA object browser, MSDN, web searches... my HTML, VBScript and JavaScript books were modestly helpful. And I wouldn't say that I know all that much.

  5. #5
    5 Star Lounger
    Join Date
    May 2002
    Location
    43.8N 81.0W, Ontario
    Posts
    815
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IE Object Model (from Access/VBA)

    If you're looking for a website reference for W3C, W3.org might be a starting point.

    Have a Great day!!!
    Ken
    <IMG SRC=http://www.wopr.com/w3tuserpics/KenK_sig.gif>

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: IE Object Model (from Access/VBA)

    I don't know if W3C is the ticket but I'll certainly have a look at this site.

    What I want is doco on how to scrape details from a site (this could include tables and other text). What Jefferson provided was an example of how to get the data from a fixed column table on a web page which proved invaluable.
    I have modified this somewhat to get what I want, but I would like to be able to access other information on this page. So any other doco on this topic would be extremely valuable.

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: IE Object Model (from Access/VBA)

    Hi everyone, another question along the same lines.

    Is there a way you can get the URL behind a variable so I can then read that page, etc, etc.

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: IE Object Model (from Access/VBA)

    Can you explain the scenario a bit more: What kind of variable and where did you get it in the first place?

  9. #9
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: IE Object Model (from Access/VBA)

    I am in unfamiliar territory here.
    When I pull up a page, and it contains a word or words that are highlighted in blue (I presume because it has a URL underneath it, is this called a hyperlink?) I need to be able to get at this URL to go to the next page, etc, etc.

  10. #10
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: IE Object Model (from Access/VBA)

    Pat, when you use the document object model, your document has several collections that could be useful here. Assume you have created an object reference to the HTML document...

    Dim myHTMLDoc As MSHTML.HTMLDocument
    Set myHTMLDoc = Something that returns an HTML document...not important for current purposes

    ... the one that seems most relevant (and, most specific, which is important to avoid mistakenly targeting some garbage code) is the links collection:

    <UL><LI>myHTMLDoc.links.length gives you the count of all links in the entire page; remember that the collection is numbered starting from zero, so the index of the last item in the collection is length-1.

    <LI>myHTMLDoc.links.item(0).innerHTML gives you the exact HTML code that is used to generate the visual display associated with the first link; it could be plain text, or text with HTML tags (such as an IMG tag), or just an image tag.

    <LI>myHTMLDoc.links.item(0).innerText gives you the visible text, if any, that is associated with the first link; HTML tags are stripped out.

    <LI>myHTMLDoc.links.item(0).href gives you the complete path for the first link.[/list]You could loop through the collection looking for a match to the expected "innerText" or use your imagination.

  11. #11
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: IE Object Model (from Access/VBA)

    Thanks Jefferson, I'm sorry to be such a pest about this but I really need to find out about this.

    Now you are talking about a Document Object Model rather than the IE Object Model which you provided some code. That code works very well thank you.

    Can the Document Object Model read in tables like the IE Object Model can?

    Where can I get some doco to read up on for the Document Object Model?

  12. #12
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: IE Object Model (from Access/VBA)

    The MSHTML library contains Microsoft's encapsulation of the document object model (DOM). It is largely compliant with the W3C model, but has proprietary extensions such as the .all collection that you will see used frequently in code written for Internet Explorer version 4. In this sense, it is and is not really the Internet Explorer object model. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> I hope that sort of clarifies the terminology.

    I guess strictly speaking the Internet Explorer object model is the one that contains the InternetExplorer object. I don't remember the name that appears in the Tools>References dialog, but it could be similar to Microsoft Internet Controls.

  13. #13
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: IE Object Model (from Access/VBA)

    Other than the Links collection, is there a text collection or something that can reference all text on a page?

  14. #14
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: IE Object Model (from Access/VBA)

    Not sure what you mean by "text." The <BODY> tag likely has an innerText property that would be the text of the entire <BODY></BODY>, stripped of HTML tags. Is that what you're looking for?

  15. #15
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: IE Object Model (from Access/VBA)

    I want to get at the text of every word on the screen, so I suppose that the "BODY" would give me all the text.
    How would I go about getting all that text into a variable?
    You have been an excellent source for this problem.

Page 1 of 2 12 LastLast

Posting Permissions

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