Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable Copy


Is it possible to disable the copy and paste function without protecting
sheets.

Thanks

Nick


--
Nick S
------------------------------------------------------------------------
Nick S's Profile: http://www.excelforum.com/member.php...o&userid=16512
View this thread: http://www.excelforum.com/showthread...hreadid=382437

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable Copy


Good afternoon Nick S

This type of request can be tricky, in that it is very easy to disabl
the menu, but there are keyboard shortcuts to consider and th
rightclcik menu to worry about, so the easiest way is to introduce
short single command macro into the ThisWorkbook that will empty th
clipboard every time an active cell changes:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVa
Target As Range)
Application.CutCopyMode = False
End Sub

This will do the trick, by allowing a user to copy, but not paste. Ad
this and it will prevent a user pasting something outside the curren
sheet:

Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.CutCopyMode = False
End Sub

The downside : this code relies on the user opting to run the macros o
the sheet opening, if they say no to the "Run macros" question the cod
will be useless.

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=38243

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable Copy


That does the tric

--
Nick
-----------------------------------------------------------------------
Nick S's Profile: http://www.excelforum.com/member.php...fo&userid=1651
View this thread: http://www.excelforum.com/showthread.php?threadid=38243

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default Disable Copy

Nick,

you can disable/control key shortcuts like CTRL+c etc with
Application.Onkey function by e.g. checking sheetname first before
allowing copying.

You could assign new macro's to Cut/copy paste buttons or just add code
to them using event sinking(Excel 2000 and later). Especially sinking
the events of all the cut/copy/paste buttons should be considered
advanced VBA.

some test code:

Public Sub nocopy()

If ActiveSheet.Name = "Sheet1" Then
MsgBox "nocopy"
Else
Application.CommandBars.FindControl(, 21).Execute ' execute
copy button
End If

End Sub

Sub test()
Application.OnKey "^c", "nocopy"
End Sub

DM Unseen

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
Disable copy and paste Igneshwara reddy[_2_] Excel Worksheet Functions 0 March 12th 07 05:20 PM
How do I disable the pop-ups that appear when I copy/paste, etc? Fiscal Al Excel Discussion (Misc queries) 1 October 31st 05 03:46 PM
disable copy paste Tim Excel Programming 7 June 30th 05 02:37 PM
Copy disable Stefan Buijs Excel Programming 3 April 28th 05 05:38 PM
Can I disable the copy feature? Tim Excel Worksheet Functions 1 April 7th 05 09:21 PM


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

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"