Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Loop with activeX optionbuttons.

Dear listmembers,

In a spreadsheet with activeX optionbuttons (not the "old" forms
optionbuttons). A macro renames the name of the object en places the new
name in de caption of the optionbutton. In this loop some of the names and
the captions are mixed. The controls get the correct names, but get a wrong
caption. If I fysically rearrange the optionbuttons in the order of the
captions, the macro still mixes up the same names and captions. In the
listing below you will find a simplified example of the code.
It the problem exist by 15 of 300 optionbuttons.
I'll hope you will understand the problem en could help me.

TIA Jan Vente

dim oleObj as OLEobject
dim optObj as msforms.optionbutton
dim wsV as Worksheet
dim intX as integer

set wsV = worksheets("Vragen")
intX = 1
For Each oleObj In wsV.OLEObjects
If TypeOf oleObj.Object Is MSForms.OptionButton Then
Set optObj = oleObj.Object
oleObj.Visible = True
strNaam = "opt" & str(intX)
oleObj.Name = strNaam
optObj.Caption = strNaam
intX = intX +1
end if
Next oleObj



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Loop with activeX optionbuttons.

Jan,
Add "Option Explicit" as the first line in the module and see what happens.
Regards,
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Jan Vente" wrote in message...
In a spreadsheet with activeX optionbuttons (not the "old" forms
optionbuttons). A macro renames the name of the object en places the new
name in de caption of the optionbutton. In this loop some of the names and
the captions are mixed. The controls get the correct names, but get a wrong
caption. If I fysically rearrange the optionbuttons in the order of the
captions, the macro still mixes up the same names and captions. In the
listing below you will find a simplified example of the code.
It the problem exist by 15 of 300 optionbuttons.
I'll hope you will understand the problem en could help me.
TIA Jan Vente


dim oleObj as OLEobject
dim optObj as msforms.optionbutton
dim wsV as Worksheet
dim intX as integer
set wsV = worksheets("Vragen")
intX = 1
For Each oleObj In wsV.OLEObjects
If TypeOf oleObj.Object Is MSForms.OptionButton Then
Set optObj = oleObj.Object
oleObj.Visible = True
strNaam = "opt" & str(intX)
oleObj.Name = strNaam
optObj.Caption = strNaam
intX = intX +1
end if
Next oleObj



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Loop with activeX optionbuttons.

Hi List,

Problem "solverd" in this posting:
http://groups.google.nl/group/micros...se_frm/thread/
b5c86d574a91b3d/e175364c6de08ee1?lnk=st&q=OLEobjects+Optionbuttons &rnum=7&hl
=nl#e175364c6de08ee1
thanks,
Jan

"Jan Vente" wrote in message
...
Dear listmembers,

In a spreadsheet with activeX optionbuttons (not the "old" forms
optionbuttons). A macro renames the name of the object en places the new
name in de caption of the optionbutton. In this loop some of the names and
the captions are mixed. The controls get the correct names, but get a

wrong
caption. If I fysically rearrange the optionbuttons in the order of the
captions, the macro still mixes up the same names and captions. In the
listing below you will find a simplified example of the code.
It the problem exist by 15 of 300 optionbuttons.
I'll hope you will understand the problem en could help me.

TIA Jan Vente

dim oleObj as OLEobject
dim optObj as msforms.optionbutton
dim wsV as Worksheet
dim intX as integer

set wsV = worksheets("Vragen")
intX = 1
For Each oleObj In wsV.OLEObjects
If TypeOf oleObj.Object Is MSForms.OptionButton Then
Set optObj = oleObj.Object
oleObj.Visible = True
strNaam = "opt" & str(intX)
oleObj.Name = strNaam
optObj.Caption = strNaam
intX = intX +1
end if
Next oleObj





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Loop with activeX optionbuttons.

Jan,
Your code worked for me in xl97 and xl2002...
after I added "Option Explicit".
Jim Cone
San Francisco, USA

"Jan Vente" wrote in message
Hi List,
Problem "solverd" in this posting:
http://groups.google.nl/group/micros...75364c6de08ee1
thanks,
Jan

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
UserForm OptionButtons Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 3 October 4th 07 07:52 PM
Moving OptionButtons MarkyB Excel Discussion (Misc queries) 2 March 7th 06 02:50 PM
OptionButtons Paul Excel Programming 4 December 4th 03 04:12 PM
Add OptionButtons in Excel Andrew Lenczycki Excel Programming 0 July 30th 03 02:34 PM
optionbuttons Phil Perry Excel Programming 1 July 10th 03 09:13 PM


All times are GMT +1. The time now is 08:30 AM.

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"