+ Reply to Thread
Results 1 to 2 of 2

VBA to IE mark a checkbox (name/element issue)

  1. #1
    Registered User
    Join Date
    03-18-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    1

    Question VBA to IE mark a checkbox (name/element issue)

    Hello,

    I have a little issue where I can't seem to find a solution.

    I want to mark a checkbox in IE via Excel/VBA . The Problem is that the there are two checkboxes with the same name. They only have different values.

    HTML:
    PHP Code: 
    <label>
                                      <
    input name="checkbox[]" type="checkbox" value="Complete"/>

                                    
    Home</label></td>



    / / /



                                      <
    input name="checkbox[]" type="checkbox" value="Cancle"/>

                                    
    Home</label></td
    I have already tried the following functions to check the checkbox:

    Please Login or Register  to view this content.
    But I always get an error message "Runtime Error 91" or no error message but the checkbox wont be selected.

    I would appreciate it if someone could tell me what I am doing wrong or have a suggestion to solve this.

    Thank you and have a nice day,

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: VBA to IE mark a checkbox (name/element issue)

    There are several ways to reference and tick the 'Cancel' checkbox - the 2nd "checkbox[]" element (array index(1)). One way is:
    Please Login or Register  to view this content.
    If you want to reference a specific checkbox by something visible to the user, e.g. its Value attribute, rather than by a specific array index, you would have to get a collection of checkboxes (e.g. using getElementsByName) and loop through them looking for one with the required Value attribute and set the Checked property of that.

+ 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