LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default locking check boxes using a macro

for each sh in thisworkbook.Worksheets
for each cbox in sh.CheckBoxes
cbox.Enabled = False
next
Next


This locks the checkbox whether the sheet is protected or not.

--
Regards,
Tom Ogilvy


"Erik Andreassen" wrote in
message ...
Hey, thanks for the help.

Working with the code, the first set works perfectly for ActiveX

checkboxes.
The second does indeed set the "locked" property for form checkboxes, but
they can still be changed when the worksheet is protected. Do you know

any
way around this? It might be that I just simply have to change all the

check
boxes to ActiveX controls.

Thanks.

"Tom Ogilvy" wrote:

What kind of checkboxes

Control Toolbox Toolbar/ActiveX Checkbox:

for each sh in thisworkbook.Worksheets
for each obj in sh.OleObjects
if typeof Obj.Object is MSForms.Checkbox then
obj.Locked = True
end if
Next
Next

CheckBox from the Forms Toolbar:

for each sh in thisworkbook.Worksheets
for each cbox in sh.CheckBoxes
cbox.Locked = True
next
Next

--
Regards,
Tom Ogilvy


"Erik Andreassen" wrote in
message ...
Hi,

Does anyone know a good way to lock all checkboxes (or other user form
objects) on a worksheet using an excel macro? I have a macro that

will
cycle
through all the worksheets in a workbook, and it needs to set the lock
property on all check boxes it finds along the way.


Thanks!






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing All check boxes using Macro Anil Kumar N. Excel Discussion (Misc queries) 4 December 27th 07 10:40 AM
Can one macro serve several check boxes? Naum Charts and Charting in Excel 3 November 16th 07 04:55 PM
Clearing Check Boxes & Running a diff Macro when unchecking the ch Vick Excel Discussion (Misc queries) 6 May 30th 07 08:44 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
inserting check boxes from a macro morry[_13_] Excel Programming 2 February 27th 04 07:25 PM


All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"