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

the reason is the procedure only applys to active sheet
so u may make a loop to walk through

Private Sub CommandButton1_Click()
Dim myObj As OLEObject
For Each myObj In ActiveWorkbook.ActiveSheet.OLEObjects
Debug.Print myObj.Name
If Len(myObj.Name) 8 Then
If Left(myObj.Name, 8) = "CheckBox" Then
myObj.Left = 50
End if
End If
Next
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default checkbox hell

Oh... I'm sorry but I don't think I explained my problem
clearly. I have two sheets with checkboxes. On sheet1, I
have four that I would like to set the checkbox left
property to 50. This is done by the following procedure,
which is invoked by clicking the command button on sheet1:

Private Sub CommandButton1_Click()
Dim myObj As OLEObject
For Each myObj In ActiveWorkbook.ActiveSheet.OLEObjects
Debug.Print myObj.Name
If Len(myObj.Name) = 8 Then
If Left(myObj.Name, 8) = "CheckBox" Then
myObj.Left = 50
End If
End If
Next
End Sub

On sheet2, I have a sample of what appears to be checkbox
controls and I attempted to do the same thing as I did for
the checkboxes on sheet1 with the following code (also
triggered with a command button on sheet2):

Private Sub CommandButton1_Click()
Dim myObj As OLEObject
For Each myObj In ActiveWorkbook.ActiveSheet.OLEObjects
Debug.Print myObj.Name
If Len(myObj.Name) = 9 Then
If Left(myObj.Name, 9) = "Check Box" Then
myObj.Left = 50
End If
End If
Next
End Sub

Here is the problem... the For Each...Next loop only finds
one OLE Objects... the command button. I don't understand
why the checkboxes' names appear in the debug window --
that is, unless they are not an OLEObject. But if that is
true, then what are they? Why can't I access the checkbox
properties in design mode?

If anyone has any idea... I'd really appreciate the help!
I've attached a copy of the excel file to my first message
of this thread.

Thanks,

Robert

-----Original Message-----
the reason is the procedure only applys to active sheet
so u may make a loop to walk through


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default checkbox hell

Hi Robert,

If your checkboxes are from the Forms toolbar, not Control
toolbox, try this:

sub test()
Dim cb As CheckBox
For Each cb In ActiveSheet.CheckBoxes
cb.Left = 100
Next
end sub

Have you thought of aligning with cells.
FWIW I've had problems dimensioning objects if
Zoom is not %100.

Regards,
Sandy


-----Original Message-----
Oh... I'm sorry but I don't think I explained my problem
clearly. I have two sheets with checkboxes. On sheet1,

I
have four that I would like to set the checkbox left
property to 50. This is done by the following procedure,
which is invoked by clicking the command button on sheet1:

Private Sub CommandButton1_Click()
Dim myObj As OLEObject
For Each myObj In ActiveWorkbook.ActiveSheet.OLEObjects
Debug.Print myObj.Name
If Len(myObj.Name) = 8 Then
If Left(myObj.Name, 8) = "CheckBox" Then
myObj.Left = 50
End If
End If
Next
End Sub

On sheet2, I have a sample of what appears to be checkbox
controls and I attempted to do the same thing as I did

for
the checkboxes on sheet1 with the following code (also
triggered with a command button on sheet2):

Private Sub CommandButton1_Click()
Dim myObj As OLEObject
For Each myObj In ActiveWorkbook.ActiveSheet.OLEObjects
Debug.Print myObj.Name
If Len(myObj.Name) = 9 Then
If Left(myObj.Name, 9) = "Check Box" Then
myObj.Left = 50
End If
End If
Next
End Sub

Here is the problem... the For Each...Next loop only

finds
one OLE Objects... the command button. I don't

understand
why the checkboxes' names appear in the debug window --
that is, unless they are not an OLEObject. But if that

is
true, then what are they? Why can't I access the

checkbox
properties in design mode?

If anyone has any idea... I'd really appreciate the

help!
I've attached a copy of the excel file to my first

message
of this thread.

Thanks,

Robert

-----Original Message-----
the reason is the procedure only applys to active sheet
so u may make a loop to walk through


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default checkbox hell

THANK YOU Sandy! I've never noticed there was a Forms
Toolbar. Thanks for the help!

Robert


-----Original Message-----
Hi Robert,

If your checkboxes are from the Forms toolbar, not

Control
toolbox, try this:

sub test()
Dim cb As CheckBox
For Each cb In ActiveSheet.CheckBoxes
cb.Left = 100
Next
end sub

Have you thought of aligning with cells.
FWIW I've had problems dimensioning objects if
Zoom is not %100.

Regards,
Sandy


-----Original Message-----
Oh... I'm sorry but I don't think I explained my problem
clearly. I have two sheets with checkboxes. On sheet1,

I
have four that I would like to set the checkbox left
property to 50. This is done by the following

procedure,
which is invoked by clicking the command button on

sheet1:

Private Sub CommandButton1_Click()
Dim myObj As OLEObject
For Each myObj In ActiveWorkbook.ActiveSheet.OLEObjects
Debug.Print myObj.Name
If Len(myObj.Name) = 8 Then
If Left(myObj.Name, 8) = "CheckBox" Then
myObj.Left = 50
End If
End If
Next
End Sub

On sheet2, I have a sample of what appears to be

checkbox
controls and I attempted to do the same thing as I did

for
the checkboxes on sheet1 with the following code (also
triggered with a command button on sheet2):

Private Sub CommandButton1_Click()
Dim myObj As OLEObject
For Each myObj In ActiveWorkbook.ActiveSheet.OLEObjects
Debug.Print myObj.Name
If Len(myObj.Name) = 9 Then
If Left(myObj.Name, 9) = "Check Box" Then
myObj.Left = 50
End If
End If
Next
End Sub

Here is the problem... the For Each...Next loop only

finds
one OLE Objects... the command button. I don't

understand
why the checkboxes' names appear in the debug window --
that is, unless they are not an OLEObject. But if that

is
true, then what are they? Why can't I access the

checkbox
properties in design mode?

If anyone has any idea... I'd really appreciate the

help!
I've attached a copy of the excel file to my first

message
of this thread.

Thanks,

Robert

-----Original Message-----
the reason is the procedure only applys to active sheet
so u may make a loop to walk through


.

.

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
Pls tell me how in hell am I to ask a technical question in 4 wor Kleberman New Users to Excel 1 April 7th 06 12:22 PM
Hyperlink hell komatik Excel Discussion (Misc queries) 2 September 6th 05 03:23 PM
checkbox hell eRiC Excel Programming 0 July 16th 04 04:40 AM
ComboBox Hell!!! Dave Baranas Excel Programming 4 August 15th 03 06:42 PM
Excel ADO.Net Hell :S Kevin Harrison Excel Programming 4 August 14th 03 11:09 AM


All times are GMT +1. The time now is 03:27 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"