LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default ++ Web automation

Hi all,

I have web interactive macro, which logs into the web.

It click serach button and result will be populated in excel but
I got one small problem here if there is no search result it will
pop window saying "no results found", then I have to click OK button
to continue the macro.
how should click ok automatically.

Please help me.

Here's the code i have used ( URL is internal )

Option Explicit
Function web_test ()
Dim ie As InternetExplorer
Dim URL As String
Dim Entid As Object, pwd As Object, form As Object
Dim pwd1 As Object, form1 As Object
Dim Fname As Object
Dim Acn As String, Acs As String
Dim Srch As Object
Dim status As Object, gender As Object, org As Object
Dim clr As Object
Dim I As Integer, Rng As Integer
Dim CID As String
Dim form2 As Object

Acn = ActiveWorkbook.Name
Acs = ActiveSheet.Name

Set ie = CreateObject("internetexplorer.application")

URL = "https://xyz.aspx "
ie.Visible = True

ie.Navigate URL

Do While ie.ReadyState < 4 Or ie.Busy = True
DoEvents
Loop

Set Entid = ie.Document.getelementsbyname("txtPersonnelNumber" )
Set pwd = ie.Document.getelementsbyname("txtPassword")
Set form = ie.Document.getelementbyid("btnLogIn")

Entid.Item(0).Value = "fiorjpde"
pwd.Item(0).Value = "********"
form.Click

Do While ie.ReadyState < 4 Or ie.Busy = True
DoEvents
Loop

Rng = Workbooks(Acn).Sheets(Acs).Cells(Rows.Count, "A").End(xlUp).Row

For I = 2 To Rng

CID = Trim(Cells(I, "A").Value)

Set Fname = ie.Document.getelementsbyname("txtCID")
Fname.Item(0).Value = CID

Set Srch = ie.Document.getelementbyid("btnSearch")
Srch.Click

Do While ie.ReadyState < 4 Or ie.Busy = True
DoEvents
Loop

Set status =
ie.Document.getelementbyid("dtgCandidateDefaultSea rchResult_ctl03_lbldtgStatus")
Cells(I, "B").Value = status.innertext

Set gender =
ie.Document.getelementbyid("dtgCandidateDefaultSea rchResult_ctl03_lblGender")
Cells(I, "C").Value = gender.innertext

Set org =
ie.Document.getelementbyid("dtgCandidateDefaultSea rchResult_ctl03_lbldtgPrevOrg")
Cells(I, "d").Value = org.innertext

Set clr = ie.Document.getelementbyid("btnClear")
clr.Click

Do While ie.ReadyState < 4 Or ie.Busy = True
DoEvents
Loop

Next I

End Function
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Supressing the ctrl-c and other keys during word automation in automation apondu Excel Programming 0 July 19th 07 10:10 PM
automation Darius New Users to Excel 1 September 23rd 05 07:37 AM
Automation from VB6 Robert A. Boudra Excel Programming 2 November 16th 04 11:20 PM
about OLE automation keyur Excel Programming 0 April 5th 04 02:54 PM
Automation [email protected] Excel Programming 0 December 12th 03 02:52 PM


All times are GMT +1. The time now is 07:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"