+ Reply to Thread
Results 1 to 14 of 14

Import Internet Info

  1. #1
    Registered User
    Join Date
    12-07-2009
    Location
    Haysville, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Import Internet Info

    Hello all. I need some help making some code in excels vba. I dont know any of the internet commands in vba and so im asking you guys for help. what i need the program to do is go to a website that i have in the first cell. This is one of the urls http://www.newegg.com/Product/Produc...82E16812270101 ( i only need it to run once i can do the rest ok). When it goes to that url i need it find all the information under specifications. you dont even have to make the code all i really need is what statement i would use to search for the stuff under specifications.

    any help is greatly appreciated.
    Thank you
    Last edited by Shadowsgone; 06-10-2010 at 09:45 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Import Internet Info

    Hello Shadowsgone,

    That website looks familiar. Didn't I help write a macro for you to look up products on that site?

    EDIT: I did help you on March 31, 2010. You posted the question here.
    Last edited by Leith Ross; 06-08-2010 at 02:18 PM.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    12-07-2009
    Location
    Haysville, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Import Internet Info

    Yes you did lol. But this time i need to specs and not the urls. I really do need to find a book on Excel VBA code or somethin lol

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Import Internet Info

    Hello Shadowsgone,

    Okay, here is the basic code to retrieve the specifications on the web page. You will need to add code to loop that returns the text for each cell (label) in the specifications.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-07-2009
    Location
    Haysville, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Import Internet Info

    in the part where you said add additional code here thats where im going to make it so it adds the data to the cells on the spreadsheet.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Import Internet Info

    Hello Shadowsgone,

    That's correct. The loop returns all the specification data.

    For Example:
    • Model
      Brand BYTECC
      Model USB2-10AB-W
      Spec
      Type USB 2.0
      Length 10 ft.
      Color White
      Connector Number 2
      Terminal Gender M-M
    Where "Model" is TblData(0)

  7. #7
    Registered User
    Join Date
    12-07-2009
    Location
    Haysville, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Import Internet Info

    ok good cause i did that but for some reason i get this error:
    run-time error '1004' method 'range' of object '_global' failed

    i went to debug it and its on this line:
    Please Login or Register  to view this content.
    so i changed it to say
    Please Login or Register  to view this content.
    i still got the same error. i took the .value out just because i had a problem with that before and that didnt change anything. im wondering if i change the code to read like this:
    Please Login or Register  to view this content.
    if that would work. ill give that a try and a few other ways if you can think of a better way please let me, i really love the help and im learning quite a bit. Thank you Ross

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Import Internet Info

    Hello Shadowsgone,

    All element collections in HTML are zero based (the first element is zero). Range rows and columns are one based (first element starts at one). You need to add 1 to I so the range will work. I have made the correction in bold.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-07-2009
    Location
    Haysville, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Import Internet Info

    Thats it!!!! Thank you so much for the help again Ross.

  10. #10
    Registered User
    Join Date
    12-07-2009
    Location
    Haysville, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Import Internet Info

    Hey Ross, I need some more help with the code you helped me on. I found out that some products have more than one table with the class name of "specification" but only one of those tables has an id name of "pcraSpecs". saddly i dont know how to change the code for this.
    this is the area i think needs the only change:
    Please Login or Register  to view this content.
    if you need the rest let me know ok

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Import Internet Info

    Hello shadowsgone,

    This should do it. It looks for DIV tag with the ID "pcraSpecs". The table cells are then listed on the worksheet. I had tried doing this in the beginning and problems. After working with the code more I understand where I went wrong.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    12-07-2009
    Location
    Haysville, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Import Internet Info

    ok i see what you did. thanks you for the help and sorry if i gave you any trouble.

  13. #13
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Import Internet Info

    Hello shadowsgone,

    You weren't any trouble. I learned some new things about the IE object model. Thanks.

  14. #14
    Registered User
    Join Date
    12-07-2009
    Location
    Haysville, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Import Internet Info

    I learned a lot of new things also so Thank you Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1