Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default web automation - repost

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_lbldtgSta*
tus")
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_lbldtgPre*
vOrg")
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




Reply
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
Had to repost it!!! Prashant Excel Discussion (Misc queries) 1 April 23rd 10 03:19 PM
Repost for Ron Jenny B. Excel Discussion (Misc queries) 1 May 21st 08 09:39 AM
Supressing the ctrl-c and other keys during word automation in automation apondu Excel Programming 0 July 19th 07 10:10 PM
REPOST: Calling Excel Automation Add-In in VBA Matthew Wieder[_3_] Excel Programming 13 June 22nd 06 06:13 PM
Please repost ans to this one Mark \(InWales\)[_15_] Excel Programming 3 November 18th 04 07:00 PM


All times are GMT +1. The time now is 11:36 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"