VB Internet Explorer onchange event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • loudey
    New Member
    • Mar 2010
    • 20

    #1

    VB Internet Explorer onchange event

    hi I'm making a macro in excel that loads up internet explorer and fills out a form. I'm able to do all of that but i have a hard time to trigger a javascript onchange event that is triggered when a user manuallay types a number in the textbox and clicks outside the box.

    here is my code for that text box

    ' Inserts unit sales price
    IEdoc.All("ctl0 0$ContentPlaceH olderMain$uxFtc $uxUnitSalesPri ce").Value = Cells(i, 10)

    and here is the source piece from the website that shows the textbox and the onchange,

    <tr><td>
    <span id="ctl00_Conte ntPlaceHolderMa in_uxFtc_uxUnit SalesPriceLabel ">Unit Sales Price:</span>
    </td><td>
    <input name="ctl00$Con tentPlaceHolder Main$uxFtc$uxUn itSalesPrice" type="text" onchange="javas cript:setTimeou t('__doPostBack (\'ctl00$Conten tPlaceHolderMai n$uxFtc$uxUnitS alesPrice\',\'\ ')', 0)" onkeypress="if (WebForm_TextBo xKeyHandler(eve nt) == false) return false;" id="ctl00_Conte ntPlaceHolderMa in_uxFtc_uxUnit SalesPrice" onfocus="StoreF ocusElementName ()" />
    <span id="ctl00_Conte ntPlaceHolderMa in_uxFtc_uxUnit SalesPriceCurre ncy">USD</span>
    </td></tr>


    I'm a begginer so this could be very simple.
    Any help would be much appreciated
    Thanks
  • loudey
    New Member
    • Mar 2010
    • 20

    #2
    I was able to figure it out but here is the code for whoever needs it in the future.

    IEdoc.All("Inpu t the name of the field that when it changes it the onchange event should activate").Fire Event ("onchange")

    Comment

    Working...