Run HTML function from Excel using VBA

FernandoGuizar
05-14-2010, 12:04 PM
Hi,

I'm trying to do some Internet Explorer automation from Excel using VBA. At certain webpage I have a drop-down list.

I have managed how to select the desired value from that list. However, I've faced a problem.

When normally selected (scrolling down with the mouse or keyboard), the change in a value runs a HTML function. Here is the HTML code for your reference:

<td nowrap align=left>
<label for="OZFClaimSettleFrm.OBJ.settleMethod_ID"><span class="jttinvis">Settlement Method</span></label><select name=OZFClaimSettleFrm.OBJ.settleMethod
id="OZFClaimSettleFrm.OBJ.settleMethod_ID" onChange=callSettleMethod(this); onFocus="selectRadios('claimSettlePage',getField('claimSettlePage','OZFClaimSet tleFrm.OBJ.settleMethod'));">
<option value=""></option>
<option value="CHECK">Check</option>
<option value="CONTRA_CHARGE">Contra Charge</option>
<option value="REG_CREDIT_MEMO">Credit Memo - Invoice</option>
<option value="CREDIT_MEMO">Credit Memo - On Account</option>
<option value="RMA">Return Material Authorizations</option>
</select>
</td>


As you can see, on any change, the following function is run:

function callSettleMethod(what)
{
document.forms.claimSettlePage.submit();
}


When I change the value on the drop-down list using VBA (see code below), only the value is changed but the function does not run. How can I do that?

Set METH = IE.document.getelementsbyname("OZFClaimSettleFrm.OBJ.settleMethod")
If Not METH Is Nothing Then
METH(0).Value = "CREDIT_MEMO"
End If


Please help, I've been going around this issue for a lot of time, updating the webpage does not work.

Any help will be highly appreciated. Thanks!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum