Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Disbale button when worksheet protected

Is there any way of disabling a button on a worksheet when the worksheet is
protected, i.e. I do not want people to click the button to refresh the data
if the sheet is protected? (the button is from the Control Toolbox toolbar)

Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Disbale button when worksheet protected

I'd just have the code in the commandbutton check to see if the worksheet is
protected:

Option Explicit
Private Sub CommandButton1_Click()
If Me.ProtectContents _
Or Me.ProtectDrawingObjects _
Or Me.ProtectScenarios Then
Beep
'or
MsgBox "it's protected"
Exit Sub
End If

'your real code
End Sub

If you're protecting the worksheet in code, you could disable the commandbutton
when you protect/unprotect the worksheet.



Sarah (OGI) wrote:

Is there any way of disabling a button on a worksheet when the worksheet is
protected, i.e. I do not want people to click the button to refresh the data
if the sheet is protected? (the button is from the Control Toolbox toolbar)

Any ideas?


--

Dave Peterson
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
Need button to add rows on protected worksheet Rick Excel Worksheet Functions 0 July 30th 08 07:32 PM
Decimal place + - button use in protected worksheet Aaron Excel Worksheet Functions 4 July 25th 07 03:39 AM
Enabling the Filter button in a class module/protected worksheet Doug Glancy Excel Programming 0 September 18th 06 08:39 PM
radio button on protected worksheet Rog[_4_] Excel Programming 3 December 29th 04 08:07 PM
Command button on a protected worksheet dad1nm Excel Programming 0 December 13th 04 07:53 PM


All times are GMT +1. The time now is 11:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"