Using VBA w/ IE6: how to run a JavaScript?

E

Ed

Using VBA in Word 2003, I've managed to navigate to a web page
(Windows XP, IE6sp2) and set an object to it, then find the two
elements on the page that I want and set objects to them also. All I
want to do is select a checkbox, then select the Next Page - lather,
rinse, repeat until I run out of pages. But I can't run the
JavaScripts that activating these elements is supposed to run.

I can find the checkbox and set
objCB.Checked = True.
Looking into the page code, the OnClick event is set to run a
JavaScript function named "selectAllCB". I tried
objCB.onclick = "selectAllCB"
but no joy.

Likewise, I can find the "Next" link, but I can't activate it to run
"javascript:showPage(2)".

How can I do this through VBA?

Ed
 
E

Ed

Wel, I got one issue solved. I can use
Call docIE.parentWindow.execScript(strNext, "JavaScript")
to navigate to the next page (strNext is the link href, which is\
"javascript:showPage(2);"

No luck yet running the checkbox onclick event or javascript function,
though.

Ed
 
E

Ed

A side trip to comp.lang.javascript gave me the answer to this one.
It's simply objCB.onclick. I guess the web object's event becomes
the VBA object's method.

Here's hoping this helps someone.
Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top