Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Disable Pasting into a Workbook

Hi
I have a workbook, Wb1. I would like to be able to copy from Wb1 and paste
to any other Wb but disable pasting into Wb1.
--
Cheers

Scotty
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default Disable Pasting into a Workbook

http://www.j-walk.com/ss/excel/faqs/protectionFAQ.htm

Regards,
Ryan--
--
RyGuy


"scottyboy" wrote:

Hi
I have a workbook, Wb1. I would like to be able to copy from Wb1 and paste
to any other Wb but disable pasting into Wb1.
--
Cheers

Scotty

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Disable Pasting into a Workbook

I have compiled the below code, when i copy from wb1 and go to copy into wb2
paste option is not available unless i open a new excel session. Think it
may have something to do with the clipboard. Any suggestions?

Public Switching As Boolean
Private Sub Workbook_activate()
DisableCutAndPaste
Switching = True
End Sub
Private Sub Workbook_Deactivate()
EnableCutAndPaste
Switching = True
End Sub
Private Sub DisableCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, True ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v", ""
Application.OnKey "+{DEL}", ""
Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub

Private Sub EnableCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub

Private Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub
Private Sub Workbook_Open()
Application.ScreenUpdating = False
For i = 1 To Worksheets.Count
Sheets(i).Visible = True
Next i
Sheets("Warning").Visible = xlVeryHidden
Application.ScreenUpdating = True
End Sub


Private Sub Workbook_beforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
For i = 1 To Worksheets.Count
Sheets("Warning").Visible = True
If Sheets(i).Visible = True And Sheets(i).Name < "Warning" Then
Sheets(i).Visible = xlVeryHidden
End If
Next i
Application.DisplayAlerts = False
EnableCutAndPaste
End Sub
--
Cheers

Scotty


"ryguy7272" wrote:

http://www.j-walk.com/ss/excel/faqs/protectionFAQ.htm

Regards,
Ryan--
--
RyGuy


"scottyboy" wrote:

Hi
I have a workbook, Wb1. I would like to be able to copy from Wb1 and paste
to any other Wb but disable pasting into Wb1.
--
Cheers

Scotty

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
URGENT - Disable links in a shared workbook Arlette[_2_] Links and Linking in Excel 1 February 2nd 08 12:09 PM
Disable print option of a worksheet/workbook Nelly07 Excel Discussion (Misc queries) 0 October 23rd 07 10:19 PM
Can you disable the save function from a shared workbook jcallahan Excel Discussion (Misc queries) 2 April 3rd 07 02:11 AM
Disable VBA code execution when loading a workbook Charles Excel Discussion (Misc queries) 4 October 14th 05 09:12 PM
Disable macro security for selected workbook Jan Excel Discussion (Misc queries) 1 June 15th 05 07:56 AM


All times are GMT +1. The time now is 07:43 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"