Results 1 to 7 of 7

Thread: Space in website structure issue

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    9

    Space in website structure issue

    Hey guys,

    I'm new here... novice programmer but old-fart engineer.

    Here's my problem, I'm trying to pull data from a website but hit a snag.

    The website has a structure: Doc.links.Item X.innerText
    X is a number, 1-150. Two questions:
    1) There is a space between "Item" and the number... how do I get VBA to recognize that?
    2) I'm searching through the 150 entries to find the ones with useful data... how do I use a FOR loop to put that # in there. In another way, it would usually be a Item(X) index, but if the # is in the actual name. As I said, I'm novice at programming, how do I make this work?

    Thanks
    Tony

  2. #2
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Space in website structure issue

    The website has a structure: Doc.links.Item X.innerText
    Could you explain what that means ?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    9

    Re: Space in website structure issue

    Niya,

    Sure, let me elaborate. Note that I'm pulling the data from my Paypal site.

    OK, here is some of my code:
    Set ie = New InternetExplorer
    ie.Visible = True
    ie.Navigate "http://www.paypal.com?login_email=LOGINemail.com"
    Dim ieDoc As HTMLDocument
    Set ieDoc = ie.Document


    I stop the code & look at the ieDoc structure. I stopped the program after the Set ieDoc instruction and go to the watch window. Within that structure, some of the data I want was here:
    ieDoc.links.Item 1.InnerHTML

    The items I want to search are "Item 1", "Item 2", "Item 3"... there is definitely a space between the 'm' and the digit.

    Does that help?
    Thanks
    Tony

  4. #4
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Space in website structure issue

    Wait a second...is this a VB6 app ? We don't use Set in VB.Net. If this is a VB6 app then this is the wrong section of these forums.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    9

    Re: Space in website structure issue

    I believe it's VB7 for applications, that's what it tells me. I'm running Office 2010, Excel.

    Tony

  6. #6
    Fanatic Member proneal's Avatar
    Join Date
    May 2011
    Posts
    762

    Re: Space in website structure issue

    Quote Originally Posted by TexasTony View Post
    Niya,

    Sure, let me elaborate. Note that I'm pulling the data from my Paypal site.

    OK, here is some of my code:
    Set ie = New InternetExplorer
    ie.Visible = True
    ie.Navigate "http://www.paypal.com?login_email=LOGINemail.com"
    Dim ieDoc As HTMLDocument
    Set ieDoc = ie.Document


    I stop the code & look at the ieDoc structure. I stopped the program after the Set ieDoc instruction and go to the watch window. Within that structure, some of the data I want was here:
    ieDoc.links.Item 1.InnerHTML

    The items I want to search are "Item 1", "Item 2", "Item 3"... there is definitely a space between the 'm' and the digit.

    Does that help?
    Thanks
    Tony
    Welcome to the forums Tony
    I'm not familiar with working on html through code as of yet but I think there may be an Links collection?
    That would basically be saying same as Links(0), do you see what I am saying? Get the Links collection and iterate through it

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    9

    Re: Space in website structure issue

    Proneal...

    Ba-da-bing!

    That was it... now to my next step....
    Thanks
    Tony

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