G
geebee
hi,
i have the following...
Public Sub ePremisTEST()
'https://secure.com/Transactions/Logon.asp
'This project includes references to "Microsoft Internet Controls" and
'"Microsoft HTML Object Library"
'Variable declarations
Dim myURL As String
Dim myURL33 As String
Dim strSearch As String
'Set starting URL and search string
myURL = "https://epremis.etenet.com/Transactions/Logon.asp"
strSearch = "user"
'Make IE navigate to the URL and make browser visible
myIE.navigate myURL
myIE.Visible = True
'Wait for the page to load
Do While myIE.Busy Or myIE.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
'Set IE document into object
Set myDoc = myIE.document
Set o = myDoc.all.tags("A")
'M = o.Length: mySubmit = -1
Dim strpassword As String
strpassword = "something"
With myDoc.getElementsByName("UserName")(0)
..Value = strSearch
End With
With myDoc.getElementsByName("Password")(0)
..Value = strpassword
End With
With myDoc.getElementsByName("Client")(0)
..Value = "DDDD"
End With
'******************************************************
'put the focus on the IE window/secure, and simulate hitting ENTER key
'note because this code puts the focus on the IE application/window,
'you cannot step through the code to see it work. you have to RUN the code
'******************************************************
Dim lHwnd As Long
lHwnd = FindWindow("IEFrame", vbNullString) 'determine if there is IE open
If lHwnd <> 0 Then
'MsgBox "IE is open!", vbInformation, "IE"
ShowWindow lHwnd, SW_SHOWNORMAL
Dim XT As Long
XT = BringWindowToTop(lHwnd) 'brings the IE window to top
Windows.Application.SendKeys "{ENTER}"
SendKeys "{ENTER}"
'While myIE.Busy: DoEvents: Wend
For r = 0 To M - 1: zz = ""
zz = zz & "Link Index : " & r & " of " & o.Length - 1
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . tabindex : " & o.Item(r).tabIndex
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . tagname : " & o.Item(r).tagName
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . href : " & o.Item(r).href
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . type : " & o.Item(r).Type
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . name : " & o.Item(r).Name
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . innerhtml : " & o.Item(r).innerHTML
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . outerhtml : " & o.Item(r).outerHTML
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . rel : " & o.Item(r).rel
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . rev : " & o.Item(r).rev
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . id : " & o.Item(r).ID
zz = zz & String(3, vbCrLf)
MsgBox zz
If InStr(1, o.Item(r).innerHTML, "View Reports", vbTextCompare) Then
MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML
o.Item(r).Click: Exit For
End If
Next
Else
MsgBox "IE isn't open!", vbInformation, "Window not found."
End If
'******************************************************
'end of put the focus on the IE window/secure, and simulate hitting ENTER key
'******************************************************
'Wait for the page to load
Do While myIE.Busy Or myIE.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
End Sub
for some reason the "o.Item(r).Click: Exit For" is not working. the link in
the web page is not being clicked programmatically. i got this to work in
another site, but not on this one. also, the debugger is pointing to the
following:
Set o = myDoc.all.tags("A")
what do i need to do?
thanks in advance,
geebee
i have the following...
Public Sub ePremisTEST()
'https://secure.com/Transactions/Logon.asp
'This project includes references to "Microsoft Internet Controls" and
'"Microsoft HTML Object Library"
'Variable declarations
Dim myURL As String
Dim myURL33 As String
Dim strSearch As String
'Set starting URL and search string
myURL = "https://epremis.etenet.com/Transactions/Logon.asp"
strSearch = "user"
'Make IE navigate to the URL and make browser visible
myIE.navigate myURL
myIE.Visible = True
'Wait for the page to load
Do While myIE.Busy Or myIE.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
'Set IE document into object
Set myDoc = myIE.document
Set o = myDoc.all.tags("A")
'M = o.Length: mySubmit = -1
Dim strpassword As String
strpassword = "something"
With myDoc.getElementsByName("UserName")(0)
..Value = strSearch
End With
With myDoc.getElementsByName("Password")(0)
..Value = strpassword
End With
With myDoc.getElementsByName("Client")(0)
..Value = "DDDD"
End With
'******************************************************
'put the focus on the IE window/secure, and simulate hitting ENTER key
'note because this code puts the focus on the IE application/window,
'you cannot step through the code to see it work. you have to RUN the code
'******************************************************
Dim lHwnd As Long
lHwnd = FindWindow("IEFrame", vbNullString) 'determine if there is IE open
If lHwnd <> 0 Then
'MsgBox "IE is open!", vbInformation, "IE"
ShowWindow lHwnd, SW_SHOWNORMAL
Dim XT As Long
XT = BringWindowToTop(lHwnd) 'brings the IE window to top
Windows.Application.SendKeys "{ENTER}"
SendKeys "{ENTER}"
'While myIE.Busy: DoEvents: Wend
For r = 0 To M - 1: zz = ""
zz = zz & "Link Index : " & r & " of " & o.Length - 1
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . tabindex : " & o.Item(r).tabIndex
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . tagname : " & o.Item(r).tagName
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . href : " & o.Item(r).href
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . type : " & o.Item(r).Type
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . name : " & o.Item(r).Name
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . innerhtml : " & o.Item(r).innerHTML
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . outerhtml : " & o.Item(r).outerHTML
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . rel : " & o.Item(r).rel
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . rev : " & o.Item(r).rev
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . id : " & o.Item(r).ID
zz = zz & String(3, vbCrLf)
MsgBox zz
If InStr(1, o.Item(r).innerHTML, "View Reports", vbTextCompare) Then
MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML
o.Item(r).Click: Exit For
End If
Next
Else
MsgBox "IE isn't open!", vbInformation, "Window not found."
End If
'******************************************************
'end of put the focus on the IE window/secure, and simulate hitting ENTER key
'******************************************************
'Wait for the page to load
Do While myIE.Busy Or myIE.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
End Sub
for some reason the "o.Item(r).Click: Exit For" is not working. the link in
the web page is not being clicked programmatically. i got this to work in
another site, but not on this one. also, the debugger is pointing to the
following:
Set o = myDoc.all.tags("A")
what do i need to do?
thanks in advance,
geebee