0

I am using the InternetExplorer object to interact with a web page, filling out a form and all that. At one point, after clicking a button on a page a Dialog box pops up asking to confirm the operation. How do I click the OK button in the popup?

The relevant JavaScript and HTML is:

function CheckMakeCurr() 
{
    if(confirm('Are you sure you want to set the\n "Last Rebalance Date" to today?')) 
        { return true; }
    else
        { return false; }
};

...

<INPUT onclick="return CheckMakeCurr()" class=button type=submit value="Make Current" name=updaterebaldt>

The Excel vba code is:

Dim oInput As IHTMLInputElement

' Initialize oInput.
...

' Click oInput.
oInput.click

' The confirm box comes up. What now?
ChaimG
  • 5,936
  • 4
  • 30
  • 45

1 Answers1

2

Before you click the link, remove the onclick handler which triggers the popup:

oInput.onclick = ""
oInput.click
Tim Williams
  • 137,250
  • 8
  • 88
  • 114