Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Proteting against a button press

Hi:

I have a spreadsheet containing buttons which activate macros. I want to protect one
sheet in the workbook so that no one can write on it, and no one can activate the buttons
without a password. When I protect sheet, I find that while the cells are protected the
button can be activated.

Can someone tell me how to set the BUTTONS so that they cant be pressed and activate the
macros.

Thanks a lot

JOhn Baker
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Proteting against a button press

You could use the sheet activate event to disable the buttons or hide them
(check the protection status of the sheet)


You could have each button's macro check the state of the sheet and jump out
without doing anything if it is protected.

If you need more help, specify where the buttons are from; control toolbox
toolbar or forms toolbar.

--
Regards,
Tom Ogilvy



"John Baker" wrote in message
...
Hi:

I have a spreadsheet containing buttons which activate macros. I want to

protect one
sheet in the workbook so that no one can write on it, and no one can

activate the buttons
without a password. When I protect sheet, I find that while the cells are

protected the
button can be activated.

Can someone tell me how to set the BUTTONS so that they cant be pressed

and activate the
macros.

Thanks a lot

JOhn Baker



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Proteting against a button press

Tom:

They are from the control toolbox. If i were to use the macro to check the state of the
sheets protection, how would I go about it? Its a viable alternative, since I only have
three buttons on that sheet, and they link to everything I want to protect.

Regards

John Baker

"Tom Ogilvy" wrote:

You could use the sheet activate event to disable the buttons or hide them
(check the protection status of the sheet)


You could have each button's macro check the state of the sheet and jump out
without doing anything if it is protected.

If you need more help, specify where the buttons are from; control toolbox
toolbar or forms toolbar.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Proteting against a button press

How about:

Option Explicit
Private Sub CommandButton1_Click()

If Me.ProtectContents _
Or Me.ProtectDrawingObjects _
Or Me.ProtectScenarios Then
MsgBox "can't run on this protected worksheet"
Exit Sub
End If

'your code here
MsgBox "hi"

End Sub




John Baker wrote:

Tom:

They are from the control toolbox. If i were to use the macro to check the state of the
sheets protection, how would I go about it? Its a viable alternative, since I only have
three buttons on that sheet, and they link to everything I want to protect.

Regards

John Baker

"Tom Ogilvy" wrote:

You could use the sheet activate event to disable the buttons or hide them
(check the protection status of the sheet)


You could have each button's macro check the state of the sheet and jump out
without doing anything if it is protected.

If you need more help, specify where the buttons are from; control toolbox
toolbar or forms toolbar.


--

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
find&press button Alex New Users to Excel 1 February 18th 10 03:39 PM
urgent help!find&press,please Alex Excel Discussion (Misc queries) 0 February 18th 10 11:37 AM
Is It Possible To Have... After A Button Press A Message Pops Up ? Chris Excel Worksheet Functions 2 May 30th 08 04:03 PM
When I Press the Enter Key Nothing happens. bigev Excel Discussion (Misc queries) 1 March 1st 06 03:05 PM
test for key press Robert Chapman Excel Programming 6 October 6th 03 05:31 PM


All times are GMT +1. The time now is 07:49 AM.

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"