MACSCRPT Archives

May 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Duncan <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Sat, 23 May 2009 22:47:04 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (44 lines)
I worked out a solution that functions but is very slow so if anyone  
has a better method I'd appreciate seeing it ...

tell application "Microsoft Excel"
	tell workbook 1
		tell worksheet 1
			set theOptionButton to every option button whose name is  
"options_yesno" and caption is "Yes"
			set the value of item 1 of theOptionButton to checkbox on
		end tell
	end tell
end tell

John Duncan
JEDtech Consulting, LLC
[log in to unmask]

On May 22, 2009, at 10:00 PM, MACSCRPT automatic digest system wrote:

> Date:    Thu, 21 May 2009 23:54:14 -0400
> From:    John Duncan <[log in to unmask]>
> Subject: Scripting Option Buttons in Excel
>
> Can anyone point me in the right direction for scripting multiple
> "Option Buttons" (radio buttons) in Excel?  If I have 2 option buttons
> with the same name they behave as a group and are mutually exclusive.
> I.E. if I have to Option Buttons both named "options_yesno" and one
> has caption "Yes" and one has caption "No", if you click Yes, then
> "No" deselects an vice-versa.
>
> The problem is I can't figure out how to address any but the first
> option button.  The following code selects the "Yes" radio button
> which is the first one but I can't figure out how to address the
> second one to make "No" select.
>
> tell application "Microsoft Excel"
> 	activate workbook theDocument
> 	tell workbook 1
> 		tell worksheet 1
> 			set the value of option button "options_yesno" to checkbox on
> 		end tell
> 	end tell
> end tell

ATOM RSS1 RSS2