Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
UserForm OptionButtons | Excel Discussion (Misc queries) | |||
Moving OptionButtons | Excel Discussion (Misc queries) | |||
OptionButtons | Excel Programming | |||
Add OptionButtons in Excel | Excel Programming | |||
optionbuttons | Excel Programming |