I am writing an Excel macro that will navigate to the utility's website and then upload all the statements associated with this account. To go to the instructions download page, I need to go to each page of the account summary. All accounts are listed in the drop-down list - when I manually select another account from the list, the page is updated to the new account. Using the hint I got from this question , I can make the macro change the value of the drop-down list. The problem is that even if she selects a new value from the list, the page does not refresh to the new account. Unfortunately, there is no direct link to each page of the account, because it looks like the drop-down menu passes the script value. I tried to copy the url from different accounts, but no matter which account in the url is the same. Here is the VBA code in question:
Do While i < intNumberAcct ie.document.getElementById("ctl00_PageContent_AccountDropDown_BillingAccountsDropDown").selectedindex = i Call downloadStatement i = i + 1 Loop
I tried updating IE after changing the value of the drop-down list, but when it is updated, it returns to the original value in the drop-down list. I also tried ie.document.getElementById("ctl00_PageContent_AccountDropDown_BillingAccountsDropDown").Click after it selected a new index, but it had no effect.
Here is the source code for the html drop-down list - I deleted a large chunk of accounts so that it is not so long and obfuscated the numbers and addresses of the account using "x":
<table style="width: 100%" cellpadding="0" cellspacing="0"> <tr> <td valign="top" class="AccountDropDownLabelCells" style="height: 25px;"> <strong>Billing Account:</strong> </td> <td valign="top" style="text-align: left" align="left"> <select name="ctl00$PageContent$AccountDropDown$BillingAccountsDropDown" onchange="javascript:setTimeout('__doPostBack(\'ctl00$PageContent$AccountDropDown$BillingAccountsDropDown\',\'\')', 0)" id="ctl00_PageContent_AccountDropDown_BillingAccountsDropDown" style="width:250px;"> <option value="xxxxx">xxxxx(16 xxxxx Dr)</option> <option selected="xxxxx" value="xxxxx">xxxxx(18 xxxxxDr)</option> <option value="xxxxx">xxxxx(20 xxxxx Dr)</option> <option value="xxxxx">xxxxx(22 xxxxxDr)</option> <option value="xxxxx">xxxxx(28 xxxxx Dr)</option> <option value="xxxxx">xxxxx(30 xxxxxDr)</option> <option value="xxxxx">xxxxx(34 xxxxxDr)</option> </select> </td> </tr> </table>
Any ideas on how to get a page to update a new account after choosing it from the drop-down list will be greatly appreciated.
source share