Using VBA to control Javascript-enabled IE

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):

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
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Doug

The only way we could really help with this would be with the real URL.

We could give you pointers but this sort of thing is pretty specific to the actual site.

Perhaps this link might help.
 
Upvote 0

Forum statistics

Threads
1,214,639
Messages
6,120,679
Members
448,977
Latest member
dbonilla0331

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top