473,770 Members | 5,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use VBA to activate JavaScript checkbox function in IE6?

Ed
I'm writing a VBA macro in Word 2003 that finds and manipulates a web
page (Win XP, IE6 sp2). I am having trouble with a checkbox. I can
find the checkbox and make it checked, but I can't figure out how to
activate the function connected to the OnClick event. Would anyone be
able to help me out here, please?

Thanks.
Ed

Jun 19 '07 #1
4 5880

Ed wrote:
I'm writing a VBA macro in Word 2003 that finds and manipulates a web
page (Win XP, IE6 sp2). I am having trouble with a checkbox. I can
find the checkbox and make it checked, but I can't figure out how to
activate the function connected to the OnClick event. Would anyone be
able to help me out here, please?

checkboxElement .onclick()

Jun 20 '07 #2
Ed
On Jun 19, 4:55 pm, "scripts.contac t" <scripts.cont.. .@gmail.com>
wrote:
Ed wrote:
I'm writing a VBA macro in Word 2003 that finds and manipulates a web
page (Win XP, IE6 sp2). I am having trouble with a checkbox. I can
find the checkbox and make it checked, but I can't figure out how to
activate the function connected to the OnClick event. Would anyone be
able to help me out here, please?

checkboxElement .onclick()
I tried
objCB.checkboxE lement.onclick( )
and
objCB.onclick()
and VBA kept giving me an error message that it expects an = after the
expression.
So I tried
objCB.onclick() = "selectAllCheck boxes"
which is the name of the function called by the onClick event, and
still nothing happened. (Checking this one box activates a function
which checks all boxes on the page.)

Here's what I've got so far:
Dim objCB
Set objCB = docIE.getElemen tById("selectAl lCB")
objCB.Checked = True ' This does check the box, but only this box.
' None of these activate the function to select all the boxes.
objCB.onclick = "selectAllCheck boxes"
Call
docIE.parentWin dow.execScript( "javascript:sel ectAllCheckboxe s",
"JavaScript ")
objCB.onclick() = "selectAllCheck boxes"

If you could drop-kick me a bit further down the road on this, I would
be very grateful.

Ed

Jun 20 '07 #3
On Jun 20, 7:43 am, Ed <prof_ofw...@ya hoo.comwrote:
On Jun 19, 4:55 pm, "scripts.contac t" <scripts.cont.. .@gmail.com>
wrote:
Ed wrote:
I'm writing a VBA macro in Word 2003 that finds and manipulates a web
page (Win XP, IE6 sp2). I am having trouble with a checkbox. I can
find the checkbox and make it checked, but I can't figure out how to
activate the function connected to the OnClick event. Would anyone be
able to help me out here, please?
checkboxElement .onclick()

I tried
objCB.checkboxE lement.onclick( )
and
objCB.onclick()
and VBA kept giving me an error message that it expects an = after the
expression.
So I tried
objCB.onclick() = "selectAllCheck boxes"
which is the name of the function called by the onClick event, and
still nothing happened. (Checking this one box activates a function
which checks all boxes on the page.)

Here's what I've got so far:
Dim objCB
Set objCB = docIE.getElemen tById("selectAl lCB")
objCB.Checked = True ' This does check the box, but only this box.
' None of these activate the function to select all the boxes.
objCB.onclick = "selectAllCheck boxes"
Call
docIE.parentWin dow.execScript( "javascript:sel ectAllCheckboxe s",
"JavaScript ")
objCB.onclick() = "selectAllCheck boxes"

If you could drop-kick me a bit further down the road on this, I would
be very grateful.
Why dont you write your own VB function to check all checkboxes. try
this:
Set checks=document .getelementsbyt agname("input")
for each check in checks
if check.type="che ckbox" then check.checked=t rue
next
OR try this if you have to use the selectAllCheckb oxes function:
docIE.parentWin dow.location.hr ef="javascript: selectAllCheckb oxes()"

OR
docIE.parentWin dow.execScript( "javascript:sel ectAllCheckboxe s()","JavaScrip t")

OR
Dim objCB
Set objCB = docIE.getElemen tById("selectAl lCB")
objCB.Checked = True
objCB.onclick

Jun 20 '07 #4
Ed
On Jun 20, 7:02 am, "scripts.contac t" <scripts.cont.. .@gmail.com>
wrote:
On Jun 20, 7:43 am, Ed <prof_ofw...@ya hoo.comwrote:
>>snip<<
OR
Dim objCB
Set objCB = docIE.getElemen tById("selectAl lCB")
objCB.Checked = True
objCB.onclick
That was it! So simple that I couldn't see it. Thank you very much!

Ed

Jun 20 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1344
by: dougloj | last post by:
I'm developing an ASP.Net application that uses checkboxes. I am trying to use client-side Javascript to capture the clicking of a checkbox when it happens via the OnClick event. In my .aspx file, I might have the checkbox coded as follows: <asp:CheckBox onclick="SeeClick(this);" AutoPostBack="False" Visible="True" ID="CheckBox1" Text="Selection1" runat="server"></asp:CheckBox>
2
2883
by: Kenneth | last post by:
Hi, In a document I have three lines that detects and redirects to another page is a session variable is 0 If Session("Customer_ID")=0 Then Response.Redirect("myPage.aspx") End If What I really would like to have is a notification for the
2
2239
by: ljlolel | last post by:
I'm posting this again because I did not explain myself well the first time, so the problem was not being addressed. I made the following page ( http://perla.princeton.edu/counselors/organization.php ) solely for the purpose of showing a bug. It is not production code, it is a test, made for testing, so style really doesn't matter. This page illustrates that, for some reason, clicking on the submit button has a different effect on the...
0
2688
by: Boricua | last post by:
I'm using ASP.NET 2.0 I got an imagebutton at the end of my form as a submit button. When the user clicks it the button becomes disabled and continues with the postback. This is what I got, ib is the imagebutton. Dim sbValid As New StringBuilder() sbValid.Append("if(typeof(Page_ClientValidate)=='function'){ ") sbValid.Append("if (Page_ClientValidate() == false) { return false; }} ")
4
2838
by: narsibvl | last post by:
Here is a piece of html code <form name="package_information" id="package_information" method="post" enctype="multipart/form-data""& lt;" <tr> <td><input type="checkbox" name="FormListName" value="31" />Adobe client-server form</td> </tr> <tr> <td><input type="checkbox" name="FormListName" value="32" />Adobe XDP form</td> </tr> <tr>
4
5713
by: Waldy | last post by:
Hi there, I have a customer requirement to provide a web application without JavaScript. A function is being written to the HTML output on some pages. The function is called __doPostBack. How do I get rid of it. There is no call to the function in the rest of the page, so why is it being written to the client?
4
6164
by: ameshkin | last post by:
I have a checkbox with an ID of svc_tp_1, and an image that corresponds with this checkbox below it. <input type="checkbox" name="checkbox" id="svc_tp_1" value="svc_tp_1" / <img src="images/screen_print.jpg" onclick="toggle('svc_tp_1'); return true;" /> I know how to get the checkbox to check when the image is clicked, but what I really want is a toggle. When a user clicks on the image, the system should first check to see if svc_tp_1...
22
2752
by: Mike1961 | last post by:
Checkbox values Hello. I have a problem with this code ASP / Javascript. The problem is JavaScript; try this LINK and select value cespiti 1) With ASP language is populated a secondary form, generated by a main form with a series of checkboxes, text fields and select;
17
2972
by: happyse27 | last post by:
Hi All, The html page(see item a below) is calling javascript(item b below), but cant work as the page show blank. Not sure if the method of calling is wrong(in terms of default directory) or javascript is wrong. using 127.0.0.1/htmlscript.html below to call the java script embedded in the following html script. I am using apache server and apache server have error 304(not modified) Been trying many methods for past 1...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10004
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.