conspirazy
New Member
- Joined
- Aug 2, 2007
- Messages
- 1
I am looking for some direction on using VBA in Excel to control a website that is using Javascript.
What I would like to do is log into a website that uses Javascript, click a few links, and capture the site contents. I can easily do this now with a website using HTML by logging into a form and clicking a button, etc.
Since the site is company confidential, the URL is not accessible, however for the purpose of some guidance and direction, lets use the following site as an example:
http://www.utopialv.com/utopia.html
Using VBA, (i.e. .Nagivate "http://www.utopialv.com/utopia.html"), how can I make it click any of the other links the site (such as 'Welcome home 2006')? If there were Username and Password boxes, any ideas on how I can identify the box names like in a HTML form and enter the information into those boxes using VBA?
Also, can a Javascript site be captured like an HTML site into a variable? For example, the code below navigates to anywho.com and looks some information, then can capture the site's contents into a variable 'doug' (please note that this is just a snippet of the entire code I'm using):
Any and all help is greatly appreciated - thank you in advance and for your reading.
Doug
What I would like to do is log into a website that uses Javascript, click a few links, and capture the site contents. I can easily do this now with a website using HTML by logging into a form and clicking a button, etc.
Since the site is company confidential, the URL is not accessible, however for the purpose of some guidance and direction, lets use the following site as an example:
http://www.utopialv.com/utopia.html
Using VBA, (i.e. .Nagivate "http://www.utopialv.com/utopia.html"), how can I make it click any of the other links the site (such as 'Welcome home 2006')? If there were Username and Password boxes, any ideas on how I can identify the box names like in a HTML form and enter the information into those boxes using VBA?
Also, can a Javascript site be captured like an HTML site into a variable? For example, the code below navigates to anywho.com and looks some information, then can capture the site's contents into a variable 'doug' (please note that this is just a snippet of the entire code I'm using):
Code:
Dim EXP
Dim lnk
Set EXP = CreateObject("InternetExplorer.application")
EXP.Visible = False
'http://www.anywho.com/qry/wp_fap
EXP.Navigate ("http://www.anywho.com/wp.html")
Do While EXP.Busy: DoEvents: Loop
Do While EXP.ReadyState <> 4: DoEvents: Loop
With EXP.Document.forms("fap_res")
.lastname.Value = last_name(a)
.firstname.Value = first_name(a)
If state(a) <> "" Then .state.Value = state(a)
If city(a) <> "" Then .city.Value = city(a)
If city(a) = "" And zipcode(a) <> "" Then .zip.Value = zipcode(a)
11 .submit
End With
Do While EXP.Busy: DoEvents: Loop
Do While EXP.ReadyState <> 4: DoEvents: Loop
30 Set strDoc = EXP.Document
bln = True
If bln Then 'As Text
doug = strDoc.body.innerText
Else 'As Html
doug = strDoc.body.innerHTML
End If
Any and all help is greatly appreciated - thank you in advance and for your reading.
Doug