Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Enable and disable worksheet controls?

Hello,

Is there a way to disable worksheet controls? For
example, I have a sheet with a series of radio buttons and
check boxes. After some data is entered and the buttons
and check boxes are set, I'd like to disable them so thay
cannot be inadvertantly changed. I thought the lock and
protect features would address this, but it seems like
they do not effect the value of the control (only the
location and size and so forth).

In the end, I'd like a macro button on the sheet which
enables and disables particular controls based on the
value of a sepparate check box. I.e., the user sets the
check box to lock (box checked), and calls the macro (by
pressing a button) to disable particular controls and
fixing their values. Or, the user sets the check box to
unlock (box uncheched), and calls the macro to enable the
particular controls, allowing their values to be reset.

Thanks so much for your time!
William DeLeo


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Enable and disable worksheet controls?

Control Toolbox Toolbar Controls:

Sub Tester1()
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Or _
TypeOf obj.Object Is MSForms.OptionButton Then
obj.Object.Enabled = False
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"William Deleo" wrote in message
...
Hello,

Is there a way to disable worksheet controls? For
example, I have a sheet with a series of radio buttons and
check boxes. After some data is entered and the buttons
and check boxes are set, I'd like to disable them so thay
cannot be inadvertantly changed. I thought the lock and
protect features would address this, but it seems like
they do not effect the value of the control (only the
location and size and so forth).

In the end, I'd like a macro button on the sheet which
enables and disables particular controls based on the
value of a sepparate check box. I.e., the user sets the
check box to lock (box checked), and calls the macro (by
pressing a button) to disable particular controls and
fixing their values. Or, the user sets the check box to
unlock (box uncheched), and calls the macro to enable the
particular controls, allowing their values to be reset.

Thanks so much for your time!
William DeLeo




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Enable and disable worksheet controls?

Thanks so much!!! I can certainly work with that.


-----Original Message-----
Control Toolbox Toolbar Controls:

Sub Tester1()
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Or _
TypeOf obj.Object Is MSForms.OptionButton Then
obj.Object.Enabled = False
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"William Deleo"

wrote in message
...
Hello,

Is there a way to disable worksheet controls? For
example, I have a sheet with a series of radio buttons

and
check boxes. After some data is entered and the buttons
and check boxes are set, I'd like to disable them so

thay
cannot be inadvertantly changed. I thought the lock and
protect features would address this, but it seems like
they do not effect the value of the control (only the
location and size and so forth).

In the end, I'd like a macro button on the sheet which
enables and disables particular controls based on the
value of a sepparate check box. I.e., the user sets the
check box to lock (box checked), and calls the macro (by
pressing a button) to disable particular controls and
fixing their values. Or, the user sets the check box to
unlock (box uncheched), and calls the macro to enable

the
particular controls, allowing their values to be reset.

Thanks so much for your time!
William DeLeo




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Enable and disable worksheet controls?

I am getting a compile error:

"User-defined type not defined" with reference to line:

TypeOf obj.Object Is MSForms.CheckBox

???


-----Original Message-----
Control Toolbox Toolbar Controls:

Sub Tester1()
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Or _
TypeOf obj.Object Is MSForms.OptionButton Then
obj.Object.Enabled = False
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"William Deleo"

wrote in message
...
Hello,

Is there a way to disable worksheet controls? For
example, I have a sheet with a series of radio buttons

and
check boxes. After some data is entered and the buttons
and check boxes are set, I'd like to disable them so

thay
cannot be inadvertantly changed. I thought the lock and
protect features would address this, but it seems like
they do not effect the value of the control (only the
location and size and so forth).

In the end, I'd like a macro button on the sheet which
enables and disables particular controls based on the
value of a sepparate check box. I.e., the user sets the
check box to lock (box checked), and calls the macro (by
pressing a button) to disable particular controls and
fixing their values. Or, the user sets the check box to
unlock (box uncheched), and calls the macro to enable

the
particular controls, allowing their values to be reset.

Thanks so much for your time!
William DeLeo




.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Enable and disable worksheet controls?

Inside the VBE, tools|References and check
MS Forms 2.0 Object library

(And are your checkboxes/optionbuttons from the control toolbox toolbar or the
Forms toolbar?)



william deleo wrote:

I am getting a compile error:

"User-defined type not defined" with reference to line:

TypeOf obj.Object Is MSForms.CheckBox

???

-----Original Message-----
Control Toolbox Toolbar Controls:

Sub Tester1()
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Or _
TypeOf obj.Object Is MSForms.OptionButton Then
obj.Object.Enabled = False
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"William Deleo"

wrote in message
...
Hello,

Is there a way to disable worksheet controls? For
example, I have a sheet with a series of radio buttons

and
check boxes. After some data is entered and the buttons
and check boxes are set, I'd like to disable them so

thay
cannot be inadvertantly changed. I thought the lock and
protect features would address this, but it seems like
they do not effect the value of the control (only the
location and size and so forth).

In the end, I'd like a macro button on the sheet which
enables and disables particular controls based on the
value of a sepparate check box. I.e., the user sets the
check box to lock (box checked), and calls the macro (by
pressing a button) to disable particular controls and
fixing their values. Or, the user sets the check box to
unlock (box uncheched), and calls the macro to enable

the
particular controls, allowing their values to be reset.

Thanks so much for your time!
William DeLeo




.


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Enable and disable worksheet controls?

Ok ... that library was not checked, so I fixed that
(thanks!). And yes they were off the forms toolbar, so
that made the error message go away.

But, the conditional isn't finding any checkboxes or
control buttons on the sheet (I added a simple message box
inside and it never comes up) and therefore it never
executes the enable/disable. Is there a way to view the
objects contained in "ActiveSheet.OLEObjects"?

Thanks so much!



-----Original Message-----
Inside the VBE, tools|References and check
MS Forms 2.0 Object library

(And are your checkboxes/optionbuttons from the control

toolbox toolbar or the
Forms toolbar?)



william deleo wrote:

I am getting a compile error:

"User-defined type not defined" with reference to line:

TypeOf obj.Object Is MSForms.CheckBox

???

-----Original Message-----
Control Toolbox Toolbar Controls:

Sub Tester1()
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Or _
TypeOf obj.Object Is MSForms.OptionButton Then
obj.Object.Enabled = False
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"William Deleo"

wrote in message
...
Hello,

Is there a way to disable worksheet controls? For
example, I have a sheet with a series of radio

buttons
and
check boxes. After some data is entered and the

buttons
and check boxes are set, I'd like to disable them so

thay
cannot be inadvertantly changed. I thought the lock

and
protect features would address this, but it seems

like
they do not effect the value of the control (only the
location and size and so forth).

In the end, I'd like a macro button on the sheet

which
enables and disables particular controls based on the
value of a sepparate check box. I.e., the user sets

the
check box to lock (box checked), and calls the macro

(by
pressing a button) to disable particular controls and
fixing their values. Or, the user sets the check

box to
unlock (box uncheched), and calls the macro to enable

the
particular controls, allowing their values to be

reset.

Thanks so much for your time!
William DeLeo




.


--

Dave Peterson

.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Enable and disable worksheet controls?

For items from the forms toolbar

Sub tester10()
Dim cbx As CheckBox
Dim oBtn As OptionButton
For Each cbx In ActiveSheet.CheckBoxes
cbx.Enabled = False
Next
For Each oBtn In ActiveSheet.OptionButtons
oBtn.Enabled = False
Next

End Sub

--
Regards,
Tom Ogilvy


"william deleo" wrote in message
...
Ok ... that library was not checked, so I fixed that
(thanks!). And yes they were off the forms toolbar, so
that made the error message go away.

But, the conditional isn't finding any checkboxes or
control buttons on the sheet (I added a simple message box
inside and it never comes up) and therefore it never
executes the enable/disable. Is there a way to view the
objects contained in "ActiveSheet.OLEObjects"?

Thanks so much!



-----Original Message-----
Inside the VBE, tools|References and check
MS Forms 2.0 Object library

(And are your checkboxes/optionbuttons from the control

toolbox toolbar or the
Forms toolbar?)



william deleo wrote:

I am getting a compile error:

"User-defined type not defined" with reference to line:

TypeOf obj.Object Is MSForms.CheckBox

???

-----Original Message-----
Control Toolbox Toolbar Controls:

Sub Tester1()
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Or _
TypeOf obj.Object Is MSForms.OptionButton Then
obj.Object.Enabled = False
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"William Deleo"
wrote in message
...
Hello,

Is there a way to disable worksheet controls? For
example, I have a sheet with a series of radio

buttons
and
check boxes. After some data is entered and the

buttons
and check boxes are set, I'd like to disable them so
thay
cannot be inadvertantly changed. I thought the lock

and
protect features would address this, but it seems

like
they do not effect the value of the control (only the
location and size and so forth).

In the end, I'd like a macro button on the sheet

which
enables and disables particular controls based on the
value of a sepparate check box. I.e., the user sets

the
check box to lock (box checked), and calls the macro

(by
pressing a button) to disable particular controls and
fixing their values. Or, the user sets the check

box to
unlock (box uncheched), and calls the macro to enable
the
particular controls, allowing their values to be

reset.

Thanks so much for your time!
William DeLeo




.


--

Dave Peterson

.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Enable and disable worksheet controls?

Or just:

With ActiveSheet
.CheckBoxes.Enabled = False
.OptionButtons.Enabled = False
End With

<g

Regards,

Vasant.


"Tom Ogilvy" wrote in message
...
For items from the forms toolbar

Sub tester10()
Dim cbx As CheckBox
Dim oBtn As OptionButton
For Each cbx In ActiveSheet.CheckBoxes
cbx.Enabled = False
Next
For Each oBtn In ActiveSheet.OptionButtons
oBtn.Enabled = False
Next

End Sub

--
Regards,
Tom Ogilvy


"william deleo" wrote in message
...
Ok ... that library was not checked, so I fixed that
(thanks!). And yes they were off the forms toolbar, so
that made the error message go away.

But, the conditional isn't finding any checkboxes or
control buttons on the sheet (I added a simple message box
inside and it never comes up) and therefore it never
executes the enable/disable. Is there a way to view the
objects contained in "ActiveSheet.OLEObjects"?

Thanks so much!



-----Original Message-----
Inside the VBE, tools|References and check
MS Forms 2.0 Object library

(And are your checkboxes/optionbuttons from the control

toolbox toolbar or the
Forms toolbar?)



william deleo wrote:

I am getting a compile error:

"User-defined type not defined" with reference to line:

TypeOf obj.Object Is MSForms.CheckBox

???

-----Original Message-----
Control Toolbox Toolbar Controls:

Sub Tester1()
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Or _
TypeOf obj.Object Is MSForms.OptionButton Then
obj.Object.Enabled = False
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"William Deleo"
wrote in message
...
Hello,

Is there a way to disable worksheet controls? For
example, I have a sheet with a series of radio

buttons
and
check boxes. After some data is entered and the

buttons
and check boxes are set, I'd like to disable them so
thay
cannot be inadvertantly changed. I thought the lock

and
protect features would address this, but it seems

like
they do not effect the value of the control (only the
location and size and so forth).

In the end, I'd like a macro button on the sheet

which
enables and disables particular controls based on the
value of a sepparate check box. I.e., the user sets

the
check box to lock (box checked), and calls the macro

(by
pressing a button) to disable particular controls and
fixing their values. Or, the user sets the check

box to
unlock (box uncheched), and calls the macro to enable
the
particular controls, allowing their values to be

reset.

Thanks so much for your time!
William DeLeo




.


--

Dave Peterson

.





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Enable and disable worksheet controls?

I can't thank you all enough. I hope this job pays well ;)


-----Original Message-----
Or just:

With ActiveSheet
.CheckBoxes.Enabled = False
.OptionButtons.Enabled = False
End With

<g

Regards,

Vasant.


"Tom Ogilvy" wrote in message
...
For items from the forms toolbar

Sub tester10()
Dim cbx As CheckBox
Dim oBtn As OptionButton
For Each cbx In ActiveSheet.CheckBoxes
cbx.Enabled = False
Next
For Each oBtn In ActiveSheet.OptionButtons
oBtn.Enabled = False
Next

End Sub

--
Regards,
Tom Ogilvy


"william deleo"

wrote in message
...
Ok ... that library was not checked, so I fixed that
(thanks!). And yes they were off the forms toolbar,

so
that made the error message go away.

But, the conditional isn't finding any checkboxes or
control buttons on the sheet (I added a simple

message box
inside and it never comes up) and therefore it never
executes the enable/disable. Is there a way to view

the
objects contained in "ActiveSheet.OLEObjects"?

Thanks so much!



-----Original Message-----
Inside the VBE, tools|References and check
MS Forms 2.0 Object library

(And are your checkboxes/optionbuttons from the

control
toolbox toolbar or the
Forms toolbar?)



william deleo wrote:

I am getting a compile error:

"User-defined type not defined" with reference to

line:

TypeOf obj.Object Is MSForms.CheckBox

???

-----Original Message-----
Control Toolbox Toolbar Controls:

Sub Tester1()
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Or _
TypeOf obj.Object Is MSForms.OptionButton

Then
obj.Object.Enabled = False
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"William Deleo"


wrote in message
...
Hello,

Is there a way to disable worksheet controls?

For
example, I have a sheet with a series of radio
buttons
and
check boxes. After some data is entered and the
buttons
and check boxes are set, I'd like to disable

them so
thay
cannot be inadvertantly changed. I thought the

lock
and
protect features would address this, but it

seems
like
they do not effect the value of the control

(only the
location and size and so forth).

In the end, I'd like a macro button on the sheet
which
enables and disables particular controls based

on the
value of a sepparate check box. I.e., the user

sets
the
check box to lock (box checked), and calls the

macro
(by
pressing a button) to disable particular

controls and
fixing their values. Or, the user sets the

check
box to
unlock (box uncheched), and calls the macro to

enable
the
particular controls, allowing their values to be
reset.

Thanks so much for your time!
William DeLeo




.


--

Dave Peterson

.





.

Reply
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
How do i disable/enable "Worksheet Move or copy" option? Saon Excel Worksheet Functions 1 May 15th 08 06:30 PM
Disable app window controls JC[_7_] Excel Programming 0 November 25th 03 09:52 PM
Disable controls on spreadsheet manishc Excel Programming 1 November 16th 03 11:08 AM
Enable/Disable Worksheet Change Event code Stuart[_5_] Excel Programming 2 November 3rd 03 07:22 PM
Enable/Disable Macros Joseph[_6_] Excel Programming 3 August 23rd 03 02:54 PM


All times are GMT +1. The time now is 04:00 AM.

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

About Us

"It's about Microsoft Excel"