View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default Disable Excel Control

You're welcome.
Accessing control properties:
-In the case of an OLECOntrol (the ones from the Control Toolbox toobar):
'Example with a checkbox
Dim cbx As MSForms.CheckBox
Set cbx = ActiveSheet.OLEObjects("Checkbox1")
cbx.Enabled = False
-In the case of a Form (the ones from the Forms toolbar, or drawing toolbar)
Dim shCbx As CheckBox
Set shCbx = ActiveSheet.CheckBoxes("Check Box 3")
shCbx.Enabled = False

Regards,
Sebastien

"wysimdnwyg" wrote:

Well, now I feel a little stupid and a little blind. That helps, and I thank
you. One more question, though. Now that I've found the control name, I
can't get it to disable. I've tried .disable, .enable = false and
.visible=false.

Thanks


"sebastienm" wrote:

While in Design mode, when you select a control, its name should be displayed
in the Name box (on the left of the excel formula bar).
So:
- if the Formula bar is not visible, you can display it by going in menu
View Formula Bar
- to switch modes Design/Run, click the Design Mode icon from the Visual
Basic toolba. You can display this toolbar through the menu View Tollbars
Visual Basic.

VBA:
For OLEObjects controls, they should be directly accessible:
Sheet1.Combobox1.ListIndex
For other objects, you should be able to access them through the Shapes
collection:
Activesheet.Shapes("Chek Box 3")...

I hope this helps,
Sebastien

"wysimdnwyg" wrote:

I have a control on my worksheet (not a User Form) that I want to disable or
remove when a certain field is populated. The problem is, I can not find the
name of the control. I can get to the 'Format Control' window, but that's no
help. Where can I find the name of that control?

thanks