LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.misc
sparx
 
Posts: n/a
Default Stop renaming or moving sheet tabs


Just to make sure you can not cut:

Sub DisableCut()
On Error Resume Next
With Application
'disables shortcut keys
.OnKey "^x", ""
'Disables Cut
.CommandBars("Standard").FindControl(ID:=21).Enabl ed = False
.CommandBars("Edit").FindControl(ID:=21).Enabled = False
.CommandBars("Cell").FindControl(ID:=21).Enabled = False
.CommandBars("Column").FindControl(ID:=21).Enabled = False
.CommandBars("Row").FindControl(ID:=21).Enabled = False
.CommandBars("Button").FindControl(ID:=21).Enabled = False
.CommandBars("XLM Cell").FindControl(ID:=21).Enabled = False
.CommandBars("Formula Bar").FindControl(ID:=21).Enabled = False
.CommandBars("Query").FindControl(ID:=21).Enabled = False
.CommandBars("Query Layout").FindControl(ID:=21).Enabled = False
.CommandBars("Object/Plot").FindControl(ID:=21).Enabled = False
.CommandBars("Phonetic Information").FindControl(ID:=21).Enabled =
False
.CommandBars("Shapes").FindControl(ID:=21).Enabled = False
.CommandBars("Inactive Chart").FindControl(ID:=21).Enabled = False
.CommandBars("ActiveX Control").FindControl(ID:=21).Enabled =
False
.CommandBars("OLE Object").FindControl(ID:=21).Enabled = False
.CommandBars("Excel Control").FindControl(ID:=21).Enabled = False
.CommandBars("WordArt Contex Menu").FindControl(ID:=21).Enabled =
False
.CommandBars("Curve").FindControl(ID:=21).Enabled = False
.CommandBars("Pictures Contex Menu").FindControl(ID:=21).Enabled =
False
.CommandBars("Rotate Mode").FindControl(ID:=21).Enabled = False
.CommandBars("Connector").FindControl(ID:=21).Enab led = False
.CommandBars("Script Anchor Popup").FindControl(ID:=21).Enabled =
False
.CommandBars("Worksheet Menu Bar").FindControl(ID:=21).Enabled =
False
End With
End Sub

Sub EnableCut()
On Error Resume Next
With Application
'enables shortcut keys
.OnKey "^x"
'Enables Cut
.CommandBars("Standard").FindControl(ID:=21).Enabl ed = True
.CommandBars("Edit").FindControl(ID:=21).Enabled = True
.CommandBars("Cell").FindControl(ID:=21).Enabled = True
.CommandBars("Column").FindControl(ID:=21).Enabled = True
.CommandBars("Row").FindControl(ID:=21).Enabled = True
.CommandBars("Button").FindControl(ID:=21).Enabled = True
.CommandBars("XLM Cell").FindControl(ID:=21).Enabled = True
.CommandBars("Formula Bar").FindControl(ID:=21).Enabled = True
.CommandBars("Query").FindControl(ID:=21).Enabled = True
.CommandBars("Query Layout").FindControl(ID:=21).Enabled = True
.CommandBars("Object/Plot").FindControl(ID:=21).Enabled = True
.CommandBars("Phonetic Information").FindControl(ID:=21).Enabled =
True
.CommandBars("Shapes").FindControl(ID:=21).Enabled = True
.CommandBars("Inactive Chart").FindControl(ID:=21).Enabled = True
.CommandBars("ActiveX Control").FindControl(ID:=21).Enabled = True
.CommandBars("OLE Object").FindControl(ID:=21).Enabled = True
.CommandBars("Excel Control").FindControl(ID:=21).Enabled = True
.CommandBars("WordArt Contex Menu").FindControl(ID:=21).Enabled =
True
.CommandBars("Curve").FindControl(ID:=21).Enabled = True
.CommandBars("Pictures Contex Menu").FindControl(ID:=21).Enabled =
True
.CommandBars("Rotate Mode").FindControl(ID:=21).Enabled = True
.CommandBars("Connector").FindControl(ID:=21).Enab led = True
.CommandBars("Script Anchor Popup").FindControl(ID:=21).Enabled =
True
.CommandBars("Worksheet Menu Bar").FindControl(ID:=21).Enabled =
True
End With
End Sub

Sub Find_Disable_Commands()
Dim myControls As CommandBarControls
Dim ctl As CommandBarControl
Set myControls = CommandBars.FindControls _
(Type:=msoControlButton, ID:=21) '21 = cut
For Each ctl In myControls
ctl.Enabled = False
Next ctl
End Sub

Sub Find_Enable_Commands()
Dim myControls As CommandBarControls
Dim ctl As CommandBarControl
Set myControls = CommandBars.FindControls _
(Type:=msoControlButton, ID:=21) '21 = cut
For Each ctl In myControls
ctl.Enabled = True
Next ctl
End Sub

and change the above code from 21 ( cut ) to:

drag-and-drop
"Allow cell drag and drop" box, 112
button controls, 52
creating toolbar shortcuts with, 23
manipulating cell contents with, 123-125
sheets and, 97

I use the top code when my file starts and it stops the user being able
to cut by either mouse or keyboard shortcut.

Also:

Sub DisableMoveorCopy()
On Error Resume Next
With Application
'Disables Move or Copy
.CommandBars("Edit").FindControl(ID:=848).Enabled = False
.CommandBars("Ply").FindControl(ID:=848).Enabled = False
.CommandBars("Ply").FindControl(ID:=847).Enabled = False
.CommandBars("Ply").FindControl(ID:=889).Enabled = False
.CommandBars("Ply").FindControl(ID:=945).Enabled = False
.CommandBars("Ply").FindControl(ID:=1561).Enabled = False
End With
End Sub

Sub EnableMoveorCopy()
On Error Resume Next
With Application
'Enables Move or Copy
.CommandBars("Edit").FindControl(ID:=848).Enabled = True
.CommandBars("Ply").FindControl(ID:=848).Enabled = True
.CommandBars("Ply").FindControl(ID:=847).Enabled = True
.CommandBars("Ply").FindControl(ID:=889).Enabled = True
.CommandBars("Ply").FindControl(ID:=945).Enabled = True
.CommandBars("Ply").FindControl(ID:=1561).Enabled = True
End With
End Sub

This lot stops the move, copy, etc.


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=542084

 
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
Sheet tabs are hidden...option is checked okamico Excel Discussion (Misc queries) 4 January 12th 06 09:14 PM
Why do sheet tabs keep disappearing? Box in Tools is checked. Arlie Excel Discussion (Misc queries) 1 January 5th 06 01:18 PM
Sheet Tabs Aaron (ireland) Excel Discussion (Misc queries) 5 July 19th 05 01:39 PM
Does excel recognise names rather than cells? Sue Excel Worksheet Functions 9 May 22nd 05 04:51 AM
Moving numbers from one sheet to another by date Jim Excel Worksheet Functions 2 December 9th 04 03:37 AM


All times are GMT +1. The time now is 07:35 PM.

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

About Us

"It's about Microsoft Excel"