+ Reply to Thread
Results 1 to 23 of 23

Excel 2010 Select IE Dropdown

  1. #1
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Excel 2010 Select IE Dropdown

    Hey all,

    I'm working on a macro that can go to a webpage and login in (got that). But then I need it to select the name of a site on a dropdown box and hit submit. Then I need it to copy an entire table to a cell in my spreadsheet (it will always be 2 columns wide).

    Any help would be much appreciated!


    Here is the code for the drop down menu:
    Please Login or Register  to view this content.
    And here is the code for the table that it prints out:
    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Excel 2010 Select IE Dropdown

    Can you post the VBA code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Not much so far, I'm stuck on this point...

    Please Login or Register  to view this content.

    EDIT:
    Might be important to mention that the table output one the button is pressed will always be a different size
    Last edited by Jman12; 12-14-2012 at 09:33 PM. Reason: Forgot stuff

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Excel 2010 Select IE Dropdown

    Kind of hard to help without a valid URL.

    A couple of things about the code though.

    You only need one With.

    There is no form1, but document does have a forms collection and you can refer to the first form using forms(0).

  5. #5
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Quote Originally Posted by Norie View Post
    Kind of hard to help without a valid URL.
    I would but it is a company website, so its confidential blah blah blah

    How do I refer to the first form and then alter the value of the first option? Sorry I don't know much about forms at all
    Last edited by Jman12; 12-14-2012 at 09:37 PM.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Excel 2010 Select IE Dropdown

    I already suggested how to refer to the first form.

    To refer to the dropdown you could use the form's elements collection.

    Perhaps something like this.
    Please Login or Register  to view this content.
    That code is not guaranteed to work at all - the cbo lines I'm a bit unsure about.

  7. #7
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Quote Originally Posted by Norie View Post
    That code is not guaranteed to work at all - the cbo lines I'm a bit unsure about.
    So far your always right. Code works great until you reach the line

    Please Login or Register  to view this content.
    Anyone know how to reference the portion of the frame?

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Excel 2010 Select IE Dropdown

    What do you mean the 'portion of the frame'?

  9. #9
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Sorry, don't know enough to not even sound stupid >.>

    I mean how to change that particular combobox. frm.Items("site") came out with an error:

    "Run-time error '438': Object doesn't support this property or method"

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Excel 2010 Select IE Dropdown

    That was the one line I was pretty sure wasn't right.

    You can try this instead,
    Please Login or Register  to view this content.
    or this
    Please Login or Register  to view this content.
    Not 100% sure about those either.

  11. #11
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Thanks so much for your help so far!!

    This works up until submitting now, it just refreshes the page?

    Please Login or Register  to view this content.

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Excel 2010 Select IE Dropdown

    Submit doesn't always work.

    Try clicking the button.
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Please Login or Register  to view this content.
    That now pops the same 438 error. I made sure to Dim As Object. Any other suggestions for me?

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Excel 2010 Select IE Dropdown

    This is the sort of thing made harder by not having the URL.

    Here's something else to try but I'm not too confident about it, as it's similar to getElementsByClassName which should work.
    Please Login or Register  to view this content.
    PS I've just created a small HTML file with the code I posted.

    When I run the code I posted in post #12 I get no errors.

  15. #15
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    First time back since the weekend. Thank you so much!!! It works great now, absolutely perfect so far! One last step...

    Need it to copy the table that results, which is encoded as:

    Please Login or Register  to view this content.
    Any wonderful tips on that Norie?

    PS. IDK how to say that you enough, even this part so far saves me like 30m a day so far.

  16. #16
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Tried very hard to get any farther. The best I can do is this:

    Please Login or Register  to view this content.
    So far all this gets me is a Value of "[object]", and I don't know how to make it anything else. I need it to copy/paste the entire 2 tables that result from this page. One is called "statusDiv", the other is "displayDiv"

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    Is this all the code there is?


    Please Login or Register  to view this content.
    DIV elements are used as containers so I would have expected there to be code for what's contain within the DIVs.

  18. #18
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Yes this is it

    I'll paste nearly the entire source code:
    Please Login or Register  to view this content.
    PS. This is after I select the site and have all the data I want copied visible.
    Last edited by Jman12; 12-20-2012 at 09:50 PM. Reason: forgot explination

  19. #19
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    How are you viewing/copying the source code?

  20. #20
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    I was just right clicking and viewing source... But going into Developer Tools in IE I get more data... sorry about that....

    Here's as much data as I can pull:
    Please Login or Register  to view this content.
    Also copying the rows instead of columns would work fine, columns would just be easier for me. But either way ^-^

  21. #21
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    It's probably easier to get the entire table rather than specific columns.

    I've got some code for that, I'll try and post it tomorrow.

  22. #22
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Thank you so much!

  23. #23
    Registered User
    Join Date
    12-12-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Excel 2010 Select IE Dropdown

    Quote Originally Posted by Norie View Post
    It's probably easier to get the entire table rather than specific columns.

    I've got some code for that, I'll try and post it tomorrow.
    Don't mean to bug you Norie I thank you for your help so far, was just wondering if youve had time to dig up this code in between the holidays? TY!

+ 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