tags:

views:

15

answers:

0

Hi,

Currently I am creating a project to automate Internet explorer. But in case of dialogue box I stuck in one case. please check my code below.

Steps to check the issue:

  1. Create one standard EXE project.
  2. Add ieframe.dll as a reference. (You can find it from system32)
  3. Select reference Microsoft HTML object library from the list.
  4. Add one form and insert two command button in it.

Copy and Paste below code in form.

'------------------------------------------------------------------------------------

Dim IE As New SHDocVw.InternetExplorer

Private Sub Command1_Click()

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate2 "http://www.groan-zone.net/jscript/alert.html"

Do Until IE.Busy
DoEvents
DoEvents
Loop

End Sub

Private Sub Command2_Click()

Dim htmDoc As HTMLDocument
Set htmDoc = IE.Document

If Not htmDoc Is Nothing Then
htmDoc.getElementsByTagName("input")(0).FireEvent ("onclick")
htmDoc.getElementsByTagName("input")(1).Checked = True
End If

End sub

'------------------------------------------------------------------------------------

now what I wanted to automate is? I want to click on that first button. it will generate an dialogue box. I want to make that checkbox value to true. But untill I click on that dialogue box's "OK" buttong it won't continue to next execution.

How can I click on that dialogue box as my code is not moving forward to next execution?

I have also attached the code for your reference.

Can anybody help me in this topic?