Dropdown value select in IE using VBA

vijayendra.shukla

New Member
Joined
Jan 29, 2010
Messages
34
hi,

I have a web application where i want to select a drop down value based upon the input provided in the excel file. I just cant seem to make it work.

Here is the source code that shows the different values of the drop down:


HTML:
           <tr>
                <td width="170px" style="font-weight: bold">Role:</td>
                <td width="10px"></td>
                <td width="200px">
                    <table class="dxeButtonEdit" cellspacing="1" cellpadding="0" id="ctl00_body_ASPxComboBoxRole" border="0" style="width:200px;border-collapse:separate;">
 <tr>
  <td style="display:none;"><input id="ctl00_body_ASPxComboBoxRole_VI" name="ctl00_body_ASPxComboBoxRole_VI" type="hidden" /></td><td class="dxic" onmousedown="return aspxDDDropDown('ctl00_body_ASPxComboBoxRole', event)" style="width:100%;"><input class="dxeEditArea" onkeydown="aspxEKeyDown('ctl00_body_ASPxComboBoxRole', event)" name="ctl00$body$ASPxComboBoxRole" id="ctl00_body_ASPxComboBoxRole_I" onblur="aspxELostFocus('ctl00_body_ASPxComboBoxRole')" onfocus="aspxEGotFocus('ctl00_body_ASPxComboBoxRole')" type="text" onchange="aspxETextChanged('ctl00_body_ASPxComboBoxRole')" readonly="readonly" style="border-width:0px;width:100%;padding-bottom:0px;padding-top:0px;margin-left:2px;padding-right:1px;margin-bottom:1px;padding-left:0px;margin-right:1px;margin-top:0px;cursor:default;" /></td><td id="ctl00_body_ASPxComboBoxRole_B-1" class="dxeButtonEditButton" onmousedown="return aspxDDDropDown('ctl00_body_ASPxComboBoxRole', event)"><table class="dxbebt" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;border-collapse:separate;">
   <tr>
    <td class="dx"><img id="ctl00_body_ASPxComboBoxRole_B-1Img" class="dxEditors_edtDropDown" src="/DMP/DXR.axd?r=1_3" alt="v" title="" style="border-width:0px;border-width:0px;" /></td>
   </tr>
  </table></td>
 </tr>
</table><input type="hidden" id="ctl00_body_ASPxComboBoxRole_DDDWS" name="ctl00_body_ASPxComboBoxRole_DDDWS" value="0:0:-1:-10000:-10000:0:-10000:-10000" /><div id="ctl00_body_ASPxComboBoxRole_DDD_PW-1" style="position:absolute;left:0px;top:0px;z-index:10000;visibility:hidden;display:none;">
 <table id="ctl00_body_ASPxComboBoxRole_DDD_PWST-1" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;border-collapse:separate;position:relative;">
  <tr>
   <td onmousedown="aspxPWMDown(event,'ctl00_body_ASPxComboBoxRole_DDD',-1,false)" style="width:200px;cursor:default;"><table id="ctl00_body_ASPxComboBoxRole_DDD_CLW-1" cellspacing="0" cellpadding="0" border="0" style="width:200px;border-collapse:collapse;border-collapse:separate;">
    <tr>
     <td id="ctl00_body_ASPxComboBoxRole_DDD_PWC-1"><table class="dxeListBox" cellspacing="0" cellpadding="0" id="ctl00_body_ASPxComboBoxRole_DDD_L" border="0" style="border-collapse:collapse;border-collapse:separate;">
      <tr>
       <td valign="top"><div id="ctl00_body_ASPxComboBoxRole_DDD_L_D" class="dxlbd" style="width:100%;overflow-x:hidden;overflow-y:auto;">
        <input id="ctl00_body_ASPxComboBoxRole_DDD_L_VI" type="hidden" name="ctl00$body$ASPxComboBoxRole$DDD$L" /><table id="ctl00_body_ASPxComboBoxRole_DDD_L_LBT" cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:collapse;border-collapse:separate;">
         <tr class="dxeListBoxItemRow">
          <td class="dxeListBoxItem">Relationship Manager</td>
         </tr><tr class="dxeListBoxItemRow">
          <td class="dxeListBoxItem">Risk Manager</td>
         </tr><tr class="dxeListBoxItemRow">
          <td class="dxeListBoxItem">App Edit</td>
         </tr><tr class="dxeListBoxItemRow">
          <td class="dxeListBoxItem">Batch Edit</td>
         </tr><tr class="dxeListBoxItemRow">
          <td class="dxeListBoxItem">Retention Manager</td>
         </tr><tr class="dxeListBoxItemRow">
          <td class="dxeListBoxItem">Help Desk</td>
         </tr>
        </table>
       </div></td>
      </tr>
     </table>******** id="dxss_192346683" type="text/javascript">
How do I select an item?

I tried this code (a portion of the code is given below) but doesnt do anything :-S


Code:
Set objCollection = ie.document.getElementsByTagName("input")
...
    ElseIf objCollection(i).ID = "ctl00_body_ASPxComboBoxRole_DDD_L_VI" And objCollection(i).Name = "ctl00$body$ASPxComboBoxRole$DDD$L" Then
        objCollection(i).Value = "Relationship Manager"
        objCollection(i).Click
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,215,455
Messages
6,124,937
Members
449,195
Latest member
Stevenciu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top