ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can't insert any controls on an unprotected worksheet (https://www.excelbanter.com/excel-programming/288037-cant-insert-any-controls-unprotected-worksheet.html)

mikeang[_2_]

Can't insert any controls on an unprotected worksheet
 
Strange problem ... Excel 2002 SP2 Win2000
I have written code to query a SQL db using ADO ... works great!
The workbook consists of several worksheets ... some are hidden an
some not.
My code will hide certain sheets when:

Private Workbook_Activate()
shtTodayHours.Visible = xlSheetHidden

and protect others ...

With shtPunches
.Protect Contents:=True, UserInterfaceonly:=True
.EnableSelection = xlNoSelection
End With

then I reverse the process ...

Private Sub Workbook_Deactivate()
For Each wks In Worksheets
wks.Visible = True 'unhide all worksheets
wks.Unprotect
next wks

My problem is that I had a few buttons and checkboxes on some sheet
that were only hidden, not protected that have disappeared sometim
during the testing of my code and I can't replace them. All sheets ar
not protected and the workbook is not either (and never was) but th
controls on the Forms & Control Toolbox are grayed out (except Toggl
Grid on the Forms & Design Mode, Properties, and View Code on th
Control Toolbox) so I can't add any new controls.
If I Insert a new worksheet into the existing workbook, I still can'
add any controls. If I create a New workbook, I can add control
there.

Any ideas what has happened?

Mike Angellotti:confused

--
Message posted from http://www.ExcelForum.com


mikeang[_3_]

Can't insert any controls on an unprotected worksheet
 
Update:
If I copy the sheets to a new workbook, the controls re-appear.


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 01:15 AM.

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