Consulting

Results 1 to 2 of 2

Thread: VBA to click OK in Javascript popup box?

  1. #1

    VBA to click OK in Javascript popup box?

    I am doing some data pulling from a website into Excel...I am automating this whole process, but this one button is causing me problems.

    Here is the website code:

    function exit(){
    if (parent.DataFrame.document.mainForm.WP_FORM_SUBMITTED.value!="TRUE") {
    if (confirm("You are now exiting Workout Prospector. Click OK to exit.\nClick CANCEL to return to the application."))
    {
    parent.DataFrame.document.mainForm.WP_EXIT.value="TRUE"
    parent.DataFrame.document.mainForm.target="_top"
    parent.DataFrame.document.mainForm.WP_FORM_SUBMITTED.value="TRUE"
    parent.DataFrame.document.mainForm.submit()
    }
    }
    }



    and I am using the following so far:

    On Error Resume Next
    For i = 0 To .Document.frames.Length - 1
    .Interactive = False
    .DisplayAlerts = False
    Call .Document.frames(i).execScript("exit()", "JavaScript")
    .Document.forms(0).submit
    If Err.Number = 0 Then

    Exit For
    End If
    Next
    On Error GoTo 0


    This will make the pop box come up...but I don't know how to make it confirm "OK" without clicking it. In order for Excel to move on to the next file I need to box clicked "OK".

    Can anyone help?

  2. #2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •