+ Reply to Thread
Results 1 to 2 of 2

Getting data from webpage using "classnames" that are the same

  1. #1
    Registered User
    Join Date
    10-19-2015
    Location
    La Crosse, Wisconsin
    MS-Off Ver
    2000
    Posts
    2

    Getting data from webpage using "classnames" that are the same

    I cannot seem to retrieve data using "getelementbyID"
    Ex: MainBal=ie.document.getelementbyID("cashAvailBal1").value

    However, thanks to one of your posts, this works.
    Ex: MainBal=ie.document.getelementsbyClassname("amount") (0).innertext

    Problem?

    The next amount I want to retrieve has the same classname. "amount"

    I tried this: ie.document.getelementbyid("cashAvailBal1").getelemensbyclassname("amount").value

    Did not work.

    Code Example Start:
    Dim MainBal As String, BudgetBal As String
    Do While IE.Busy
    Application.WAIT DateAdd("s", 1, Now)
    Loop
    'This works just fine
    MainBal = IE.document.getElementsByClassName("amount")(0).innerText

    Do While IE.Busy
    Application.WAIT DateAdd("s", 1, Now)
    Loop

    'This does not
    BudgetBal = IE.document.getElementsByClassName("amount")(1).innerText

    MsgBox MainBal & vbLf & BudgetBal
    Code Example End

    Any help with this would be greatly appreciated.

    BTW this is my first post

  2. #2
    Registered User
    Join Date
    10-19-2015
    Location
    La Crosse, Wisconsin
    MS-Off Ver
    2000
    Posts
    2

    Re: Getting data from webpage using "classnames" that are the same

    Problem solved. By accident. The second set of () indicates the field that is to be accessed.
    But still cannot run the macro without the error messages before each attempt to either input data or retrieve data.
    Macro is successful, but requires a restart after error messages.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to interact with a "Browse for file..." pop-up window on a webpage?
    By tnuis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2013, 10:43 AM
  2. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  3. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  4. [SOLVED] "Paste method of worksheet class failed." Copying from webpage
    By bubleeshaark in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2013, 01:19 PM
  5. Replies: 2
    Last Post: 06-06-2013, 12:45 PM
  6. [SOLVED] Data validation: allow entry into a cell if other three cells have "X", "Y" and "Z"?
    By RogerRangeRover in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2013, 04:49 AM
  7. Click "Export" on a webpage is not bringing up File Download box
    By CJK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-30-2012, 06:45 PM
  8. Click "Export" on a webpage is not bringing up File Download box
    By CJK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-26-2012, 05:25 PM

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