ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Initializing Option Buttons in Excel 2007 (https://www.excelbanter.com/excel-programming/394749-initializing-option-buttons-excel-2007-a.html)

[email protected]

Initializing Option Buttons in Excel 2007
 
I have 2 option buttons on a worksheet. In Excel 2003, I initialized
them from the workbook_open event with the line:
sh.OLEObjects("EditorButton").Object.Value = 0
sh.OLEObjects("AuthorButton").Object.Value = 0
All other sheets in the workbook are hidden, except the one the
buttons are on.
After converting to Excel 2007, and converting the file to a .xlsm,
those lines give errors. I tried moving the lines to the
worksheet_activate event, but that doesn't seem to get executed when
the workbook opens.

I think they are forms buttons, but I'm not sure, and I don't know how
to tell.


Jim Rech

Initializing Option Buttons in Excel 2007
 
Well if they are Forms toolbar option buttons you can set them like this in
either Excel 2003 or 2007:

sh.OptionButtons("Option Button 1").Value = True

where sh is set to a worksheet.

--
Jim
wrote in message
oups.com...
I have 2 option buttons on a worksheet. In Excel 2003, I initialized
them from the workbook_open event with the line:
sh.OLEObjects("EditorButton").Object.Value = 0
sh.OLEObjects("AuthorButton").Object.Value = 0
All other sheets in the workbook are hidden, except the one the
buttons are on.
After converting to Excel 2007, and converting the file to a .xlsm,
those lines give errors. I tried moving the lines to the
worksheet_activate event, but that doesn't seem to get executed when
the workbook opens.

I think they are forms buttons, but I'm not sure, and I don't know how
to tell.




[email protected]

Initializing Option Buttons in Excel 2007
 
Thanks, Jim. That didn't work, but once I removed the optionbuttons
from the group they were in, the original syntax worked. I think
sh.optionbuttons is no longer valid in Excel 2007.
Felsa

On Aug 3, 4:35 pm, "Jim Rech" wrote:
Well if they are Forms toolbaroptionbuttons you can set them like this in
eitherExcel2003 or 2007:

sh.OptionButtons("OptionButton1").Value = True

where sh is set to a worksheet.

--
wrote in message

oups.com...



I have 2optionbuttons on a worksheet. InExcel2003, I initialized
them from the workbook_open event with the line:
sh.OLEObjects("EditorButton").Object.Value = 0
sh.OLEObjects("AuthorButton").Object.Value = 0
All other sheets in the workbook are hidden, except the one the
buttons are on.
After converting toExcel2007, and converting the file to a .xlsm,
those lines give errors. I tried moving the lines to the
worksheet_activate event, but that doesn't seem to get executed when
the workbook opens.


I think they are forms buttons, but I'm not sure, and I don't know how
to tell.- Hide quoted text -


- Show quoted text -





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com