locked
Javascript Submit method not invoked while doing a button click programatically using MSHTML RRS feed

  • Question

  • Hi all,

    My requirement is to open a HTML file programatically , fill up some values and click the submit button in the file. On click the data will be saved and an email will be sent. For that below code is used in the button42 click event in javascript

    var targetURL = "mailto:"+ emailId +"?subject=" + subject;
    alert(targetURL) 
    objForm.action = targetURL;
    objForm.submit();

     

    while checking the targetURL value , it is getting the proper values. If i paste the value in targetURL into IE address bar or open the HTML manually and click submit button , the email goes through outlook. But when i invoke the submit button click , through the below excel VBA code it is not sending emails.

    Dim EcubeDocument As New MSHTML.HTMLDocument
    Set EcubeDocument = HTMLDoc.createDocumentFromUrl("C:\TEST.HTML", "Ecubetest")
    Set HTMLButton = EcubeDocument.getElementsByName("Button42").Item(Null, 0)
    HTMLButton.Click

    I believe this will be the case though i will invoke the click event using a C# has code with MSHTML.

    Please let me know how this can be fixed.

     

     

    Tuesday, September 7, 2010 2:12 PM