Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Checkbox problem

Hi all,

I have a problem, I'm trying to modify the visible property or the value in
a checkbox inside a worksheet through a macro; I found in the F1 help of MS
Excel the way to do this, my code is like this:

Sub FiltrarBandas()
Sheets("HojaBase").CheckBoxes.Value = xlOff
Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True
End Sub

But Excel gives me the error 1004 that the OLEObjects property cannot be
called from the WorkSheet class.

Do anyone knows how can I modify the checkbox properties from a macro??

Thank you very much!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Checkbox problem

hi
i got an error too but i did get this line to work.....

Worksheets("HojaBase").CheckBox6.Value = True

Regards
FSt1

"japfvg" wrote:

Hi all,

I have a problem, I'm trying to modify the visible property or the value in
a checkbox inside a worksheet through a macro; I found in the F1 help of MS
Excel the way to do this, my code is like this:

Sub FiltrarBandas()
Sheets("HojaBase").CheckBoxes.Value = xlOff
Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True
End Sub

But Excel gives me the error 1004 that the OLEObjects property cannot be
called from the WorkSheet class.

Do anyone knows how can I modify the checkbox properties from a macro??

Thank you very much!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Checkbox problem

Have you tried

Worksheets("HojaBase").Shapes("CheckBox6").Value = True

"japfvg" wrote:

Hi all,

I have a problem, I'm trying to modify the visible property or the value in
a checkbox inside a worksheet through a macro; I found in the F1 help of MS
Excel the way to do this, my code is like this:

Sub FiltrarBandas()
Sheets("HojaBase").CheckBoxes.Value = xlOff
Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True
End Sub

But Excel gives me the error 1004 that the OLEObjects property cannot be
called from the WorkSheet class.

Do anyone knows how can I modify the checkbox properties from a macro??

Thank you very much!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Checkbox problem

It looks like you're mixing code for checkboxes from the Forms toolbar with code
for checkboxes from the control toolbox toolbar.

I'm guessing that this was not your intention.

That first line:
Worksheets("HojaBase").CheckBoxes.Value = xlOff
is for checkboxes from the Forms toolbar.

If those are what you're really using, try:
Worksheets("HojaBase").checkboxes("Check Box 6").Value = xlon

========

Unless you've renamed those Forms checkboxes, they'll have names like:
Check Box 1
Check Box 2
....
Check Box 99

The Checkboxes from the Control toolbox toolbar have names like:
Checkbox1
Checkbox2
....
Checkbox99

=============
If you're really using checkboxes from the control toolbox toolbar:

Option Explicit
Sub FiltrarBandas()
Dim OLEObj As OLEObject

For Each OLEObj In Worksheets("HojaBase").OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
If LCase(OLEObj.Name) = LCase("checkbox6") Then
OLEObj.Object.Value = True
Else
OLEObj.Object.Value = False
End If
End If
Next OLEObj
End Sub

japfvg wrote:

Hi all,

I have a problem, I'm trying to modify the visible property or the value in
a checkbox inside a worksheet through a macro; I found in the F1 help of MS
Excel the way to do this, my code is like this:

Sub FiltrarBandas()
Sheets("HojaBase").CheckBoxes.Value = xlOff
Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True
End Sub

But Excel gives me the error 1004 that the OLEObjects property cannot be
called from the WorkSheet class.

Do anyone knows how can I modify the checkbox properties from a macro??

Thank you very much!!


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Checkbox problem

Thank you for this answer but Excel told that this object doesn't acept the
property value.


"Barb Reinhardt" wrote:

Have you tried

Worksheets("HojaBase").Shapes("CheckBox6").Value = True

"japfvg" wrote:

Hi all,

I have a problem, I'm trying to modify the visible property or the value in
a checkbox inside a worksheet through a macro; I found in the F1 help of MS
Excel the way to do this, my code is like this:

Sub FiltrarBandas()
Sheets("HojaBase").CheckBoxes.Value = xlOff
Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True
End Sub

But Excel gives me the error 1004 that the OLEObjects property cannot be
called from the WorkSheet class.

Do anyone knows how can I modify the checkbox properties from a macro??

Thank you very much!!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Checkbox problem

Thank you very much, you were right, I was mixing but I used the method for
the forms toolbar and it worked.

Thanks a lot again

"Dave Peterson" wrote:

It looks like you're mixing code for checkboxes from the Forms toolbar with code
for checkboxes from the control toolbox toolbar.

I'm guessing that this was not your intention.

That first line:
Worksheets("HojaBase").CheckBoxes.Value = xlOff
is for checkboxes from the Forms toolbar.

If those are what you're really using, try:
Worksheets("HojaBase").checkboxes("Check Box 6").Value = xlon

========

Unless you've renamed those Forms checkboxes, they'll have names like:
Check Box 1
Check Box 2
....
Check Box 99

The Checkboxes from the Control toolbox toolbar have names like:
Checkbox1
Checkbox2
....
Checkbox99

=============
If you're really using checkboxes from the control toolbox toolbar:

Option Explicit
Sub FiltrarBandas()
Dim OLEObj As OLEObject

For Each OLEObj In Worksheets("HojaBase").OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
If LCase(OLEObj.Name) = LCase("checkbox6") Then
OLEObj.Object.Value = True
Else
OLEObj.Object.Value = False
End If
End If
Next OLEObj
End Sub

japfvg wrote:

Hi all,

I have a problem, I'm trying to modify the visible property or the value in
a checkbox inside a worksheet through a macro; I found in the F1 help of MS
Excel the way to do this, my code is like this:

Sub FiltrarBandas()
Sheets("HojaBase").CheckBoxes.Value = xlOff
Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True
End Sub

But Excel gives me the error 1004 that the OLEObjects property cannot be
called from the WorkSheet class.

Do anyone knows how can I modify the checkbox properties from a macro??

Thank you very much!!


--

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
Checkbox Problem, Please Help! Magnivy Excel Programming 1 August 30th 06 04:37 PM
Checkbox problem WLMPilot Excel Programming 1 July 23rd 06 02:47 PM
problem with checkbox control Giselle Excel Worksheet Functions 1 March 31st 06 12:57 PM
Checkbox problem Patrick Simonds Excel Programming 1 September 29th 05 08:47 AM
Checkbox problem Patrick Simonds Excel Programming 1 September 29th 05 05:37 AM


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

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"