Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through all URL in a web page - MS Access VBA

Status
Not open for further replies.

Omar2009

IS-IT--Management
Nov 6, 2008
3
US
I have a web page that has 91 links , every link when you click it have information. I need to be able to automate clicking on the link and then screen scape the secound page. I have the next part done, But i am having with the first part .

Below is my starting code.

Private Sub Command4_Click()

' All week except monday process.

Dim boolFound As Boolean
Dim temp As String
Dim strUser As String, strPassword As String
Dim line1 As String, line2 As String, line3 As String
Dim datTime As Date
Dim Y$

Open "H:\Info.txt" For Input As #1
Line Input #1, line1
Line Input #1, line2

Close #1

strUser = line1
strPassword = line2

sTime = Time

Dim rstLoad As DAO.Recordset, strCnn As String
Dim db As DAO.Database
Set db = CurrentDb
Set rstLoad = db.OpenRecordset("Select * from Tbl_WebLoad")

SQL1 = "Delete * from Tbl_WebLoad"

CurrentDb.Execute SQL1

GetOpenIEByURL ("
Set o2 = CreateObject("internetexplorer.application")
o2.Navigate " 'IE navigates to a webpage
o2.Visible = True
While o2.Busy: DoEvents: Wend

o2.Document.all("user").Value = strUser 'Insert User Name
o2.Document.all("password").Value = strPassword ' Insert Password
o2.Document.all("switch").Click 'Submit form

While o2.Busy: DoEvents: Wend 'Wait till page fully loads

strTempR = "'strTempD = "
While o2.Busy: DoEvents: Wend 'Wait till page fully loads

o2.Navigate strTempR 'navigates to a Risc webpage
While o2.Busy: DoEvents: Wend 'Wait till page fully loads

'o2.Navigate strTempD 'navigates to a data webpage

'While o2.Busy: DoEvents: Wend

Set o = o2.Document.all.tags("SCRIPT")
M = o.Length: mySubmit = -1
x = 0

For r = x To M - 1


If Trim(InStr(1, o.Item(r).innerText, PrintFileURL, vbTextCompare)) Then

o.Item(r).Focus
o.Item(r).Click ': Exit For

While o2.Busy: DoEvents: Wend
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top