ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IE Automation (https://www.excelbanter.com/excel-programming/444092-ie-automation.html)

fi.or.jp.de

IE Automation
 
Hi All,

I need some help to run my code faster. ( Excel to Web Automation )

The bloew codes logs in web site & gets the status, for the search
value mentioned in col A

I want to run for 300 hundred records, I can do loop BUT is there any
way get the results very fast. ???

Currenty It takes 40 records per minute.

Function web_test()

Set IE = New InternetExplorer

URL = confidential
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")

With login
ENTID.Item(0).Value = .username_tx
PWD.Item(0).Value = .password_tx
FORM.Click
End With

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

IE.Navigate2 "Confidential 2.aspx"

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

VIP = Trim(Cells(1, "a").Value)

Set FNAME = IE.Document.getelementsbyname("txtCID")
FNAME.Item(0).Value = VIP

Set SRCH = IE.Document.getelementbyid("btnSearch")
SRCH.Click

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

Set ID_ID =
IE.Document.getelementbyid("dtgSearchResult_ctl03_ lbldtgCID")
Cells(I, "B").Value = ID_ID.innertext

End Function

James Ravenswood

IE Automation
 
On Jan 5, 6:59*pm, "fi.or.jp.de" wrote:
Hi All,

I need some help to run my code faster. ( Excel to Web Automation )

The bloew codes logs in web site & gets the status, for the search
value mentioned in col A

I want to run for 300 hundred records, I can do loop BUT is there any
way get the results very fast. ???

Currenty It takes 40 records per minute.

Function web_test()

Set IE = New InternetExplorer

URL = confidential
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")

With login
* * ENTID.Item(0).Value = .username_tx
* * PWD.Item(0).Value = .password_tx
* * FORM.Click
End With

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

IE.Navigate2 "Confidential 2.aspx"

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

VIP = Trim(Cells(1, "a").Value)

Set FNAME = IE.Document.getelementsbyname("txtCID")
* * FNAME.Item(0).Value = VIP

* * Set SRCH = IE.Document.getelementbyid("btnSearch")
* * SRCH.Click

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

Set ID_ID =
IE.Document.getelementbyid("dtgSearchResult_ctl03_ lbldtgCID")
*Cells(I, "B").Value = ID_ID.innertext

End Function


Do you need to open a new IE in the loop? Can you open it just once
and navigate in the loop?

fi.or.jp.de

IE Automation
 
On Jan 8, 5:43*am, James Ravenswood
wrote:
On Jan 5, 6:59*pm, "fi.or.jp.de" wrote:









Hi All,


I need some help to run my code faster. ( Excel to Web Automation )


The bloew codes logs in web site & gets the status, for the search
value mentioned in col A


I want to run for 300 hundred records, I can do loop BUT is there any
way get the results very fast. ???


Currenty It takes 40 records per minute.


Function web_test()


Set IE = New InternetExplorer


URL = confidential
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")


With login
* * ENTID.Item(0).Value = .username_tx
* * PWD.Item(0).Value = .password_tx
* * FORM.Click
End With


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


IE.Navigate2 "Confidential 2.aspx"


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


VIP = Trim(Cells(1, "a").Value)


Set FNAME = IE.Document.getelementsbyname("txtCID")
* * FNAME.Item(0).Value = VIP


* * Set SRCH = IE.Document.getelementbyid("btnSearch")
* * SRCH.Click


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


Set ID_ID =
IE.Document.getelementbyid("dtgSearchResult_ctl03_ lbldtgCID")
*Cells(I, "B").Value = ID_ID.innertext


End Function


Do you need to open a new IE in the loop? *Can you open it just once
and navigate in the loop?



I don't need to open new IE.
I want to loop, here's my code

For J = 1 to Cells(Rows.count,"A").end(xlup).row

VIP = Trim(Cells(J, "a").Value)

Set FNAME = IE.Document.getelementsbyname("txtCID")
FNAME.Item(0).Value = VIP

Set SRCH = IE.Document.getelementbyid("btnSearch")
SRCH.Click

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

Set ID_ID =
IE.Document.getelementbyid("dtgSearchResult_ctl03_ lbldtgCID")
Cells(J, "B").Value = ID_ID.innertext

Next J

AB[_2_]

IE Automation
 
It might not do that much speed-wise but I'm thinking you don't need
to use the
SET element USE element
structure. I mean, you could just use the element sraight away:

with IE.Document
..getelementsbyname("txtCID").Item(0).Value = VIP
..getelementbyid("btnSearch").Click
Cells(J, "B").Value
= .getelementbyid("dtgSearchResult_ctl03_lbldtgCID") .innertext
end with


On Jan 8, 11:10*am, "fi.or.jp.de" wrote:
On Jan 8, 5:43*am, James Ravenswood
wrote:





On Jan 5, 6:59*pm, "fi.or.jp.de" wrote:


Hi All,


I need some help to run my code faster. ( Excel to Web Automation )


The bloew codes logs in web site & gets the status, for the search
value mentioned in col A


I want to run for 300 hundred records, I can do loop BUT is there any
way get the results very fast. ???


Currenty It takes 40 records per minute.


Function web_test()


Set IE = New InternetExplorer


URL = confidential
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")


With login
* * ENTID.Item(0).Value = .username_tx
* * PWD.Item(0).Value = .password_tx
* * FORM.Click
End With


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


IE.Navigate2 "Confidential 2.aspx"


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


VIP = Trim(Cells(1, "a").Value)


Set FNAME = IE.Document.getelementsbyname("txtCID")
* * FNAME.Item(0).Value = VIP


* * Set SRCH = IE.Document.getelementbyid("btnSearch")
* * SRCH.Click


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


Set ID_ID =
IE.Document.getelementbyid("dtgSearchResult_ctl03_ lbldtgCID")
*Cells(I, "B").Value = ID_ID.innertext


End Function


Do you need to open a new IE in the loop? *Can you open it just once
and navigate in the loop?


I don't need to open new IE.
I want to loop, here's my code

For J = 1 to Cells(Rows.count,"A").end(xlup).row

VIP = Trim(Cells(J, "a").Value)

Set FNAME = IE.Document.getelementsbyname("txtCID")
* * FNAME.Item(0).Value = VIP

Set SRCH = IE.Document.getelementbyid("btnSearch")
* * SRCH.Click

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

Set ID_ID =
IE.Document.getelementbyid("dtgSearchResult_ctl03_ lbldtgCID")
* Cells(J, "B").Value = ID_ID.innertext

Next J- Hide quoted text -

- Show quoted text -




All times are GMT +1. The time now is 03:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com