Tim
"spaceman33" <barg...@gmail.com> wrote in message
news:da5r97$b3q$1...@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Thanks for the info.
I found the code I had previously used:
=========================================================
Sub Button4_Click()
'AA
a = ""
url = "http://login.americasarmy.com/views/login.php"
'Const url As String = link
Dim IE As Object
Set IE = CreateObject("internetexplorer.application")
With IE
.Visible = True
.navigate url
Do While .ReadyState <> 4: Loop
a = .document.body.innertext
End With
'enter login details
IE.document.all("username").Value = "username"
IE.document.all("password").Value = "password"
With IE.document.Forms(0)
.submit.Click
End With
'get score
#####THIS NEXT PART IS WHERE I WANT TO DO THE SEARCHING FOR THE STRING
Experience Required for Next Level#####
Position = InStr(1, a, "Experience Required for Next Level",
vbTextCompare)
honour = ""
For z = 13 To 25
If Asc(Mid$(a, Position + z, 1)) = 13 Then z = 25: GoTo 599
honour = honour & Mid$(a, Position + z, 1)
599
Next z
MsgBox honour
Set IE = Nothing
End Sub
==========================================================
How would I put that code into the above? I am already at the web site
page I want to grab the information from, I just need to get the
information from a section of the web page (different table or whatever
it is).
Thanks.
"Tim Williams" <saxifrax@pacbell*dot*net> wrote in message
news:OqJfkUzf...@TK2MSFTNGP09.phx.gbl...
You can then parse out the info from the returned string. I can't
help much with that, not having seem the text you need to separate.
Tim.
Sub tester()
MsgBox GetPageText("http://login.americasarmy.com/views/login.php")
End Sub
'Find an IE window with matching location and get the Text from
' the loaded page. Assumes no frames.
Function GetPageText(sAddress As String) As String
Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As String, sURL As String
retVal = ""
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows
'see if IE is already open
For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.Document.Location
On Error GoTo 0
If sURL <> "" Then
If sURL Like sAddress & "*" Then
retVal = o.Document.body.innerText
Exit For
End If
End If
Next o
GetPageText = retVal
End Function
"spaceman33" <barg...@gmail.com> wrote in message
news:da6ocr$dk4$1...@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
I think I need to select the frame with the ID <table id="member-jacket"
class="info info-member" cellspacing="1">, but don't know how to select it
to get the text from there.
I'm not clued up on HTML, but hopefully that is the name of the frame I want
to grab info from?
"Tim Williams" <saxifrax@pacbell*dot*net> wrote in message
news:%23IWLST1...@tk2msftngp13.phx.gbl...
Try replacing
retVal = o.Document.body.innerText
with
retVal =
o.Document.getElementById("member-jacket").rows[0].cells[0].innerText
(watch out for wrapping)
This will get you the first cell in the table - adjust to (eg.)
"rows[3].cells[4]" to get the text you want.
That should get you closer
Tim.
"spaceman33" <barg...@gmail.com> wrote in message
news:da89nk$247$1...@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
I had another look this evening and found out that the refreshed page
details weren't being passed to my variable.
I entered my login details, pressed the submit button, and then when I got
the web page text, it was still on the old page, so I just repeated the
procedure again because login lasts 30 minutes, so it goes straight to the
passworded page with the details on I want to extract, and did it that way.
It means openening IE twice to do the job, but at least it works now.
Thanks.
Just had a moment of inspiration and produced a work around.
"Tim Williams" <saxifrax@pacbell*dot*net> wrote in message
news:ehQxvSA...@TK2MSFTNGP10.phx.gbl...