Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello everyone,
Quite new to VBA etc stuff (but not new to programming), I am looking on ways to catch a user's copy/cut + paste command from all possible locations (edit menu, keyboard shortcuts, other if any (are there others?), then do some modifications in the cells being copied/moved and then paste to wherever the user wanted to copy the stuff. How do I do that ? Many thanks in advance, -arifi |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This one prevents people from all ways of cutting/copying
and pasting when your workbook is open. I think you can derive what you need from that... Run DisableCutAndPaste from a suitable event procedure (e.g. Workbook_Open or Worksheet_Activate) and EnableCutAndPaste from another (e.g. Workbook_Close or Worksheet_Deactivate). Sub DisableCutAndPaste() EnableControl 21, False ' cut EnableControl 19, False ' 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 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 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 -----Original Message----- Hello everyone, Quite new to VBA etc stuff (but not new to programming), I am looking on ways to catch a user's copy/cut + paste command from all possible locations (edit menu, keyboard shortcuts, other if any (are there others?), then do some modifications in the cells being copied/moved and then paste to wherever the user wanted to copy the stuff. How do I do that ? Many thanks in advance, -arifi . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, this will do the job probably.
Many thanks. Cheers -arifi "Serkan" wrote in message ... This one prevents people from all ways of cutting/copying and pasting when your workbook is open. I think you can derive what you need from that... Run DisableCutAndPaste from a suitable event procedure (e.g. Workbook_Open or Worksheet_Activate) and EnableCutAndPaste from another (e.g. Workbook_Close or Worksheet_Deactivate). Sub DisableCutAndPaste() EnableControl 21, False ' cut EnableControl 19, False ' 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 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 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 -----Original Message----- Hello everyone, Quite new to VBA etc stuff (but not new to programming), I am looking on ways to catch a user's copy/cut + paste command from all possible locations (edit menu, keyboard shortcuts, other if any (are there others?), then do some modifications in the cells being copied/moved and then paste to wherever the user wanted to copy the stuff. How do I do that ? Many thanks in advance, -arifi . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi...
Again, thanks for the information below. Now the question has taken a different form though. As I understand, the mechanisms I implement similar to the ones below exist in the workbook they are defined in only (as expected). But, what I need to have is that the mechanism I implement will be available vor every excel worksheet opened in the company. Is there a mechanism to create a "master" or whatever excel file to be installed on everyones PC that will incorporate my stuff into their excel sessions ? TIA,A -arifi "Serkan" wrote in message ... This one prevents people from all ways of cutting/copying and pasting when your workbook is open. I think you can derive what you need from that... Run DisableCutAndPaste from a suitable event procedure (e.g. Workbook_Open or Worksheet_Activate) and EnableCutAndPaste from another (e.g. Workbook_Close or Worksheet_Deactivate). Sub DisableCutAndPaste() EnableControl 21, False ' cut EnableControl 19, False ' 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 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 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 -----Original Message----- Hello everyone, Quite new to VBA etc stuff (but not new to programming), I am looking on ways to catch a user's copy/cut + paste command from all possible locations (edit menu, keyboard shortcuts, other if any (are there others?), then do some modifications in the cells being copied/moved and then paste to wherever the user wanted to copy the stuff. How do I do that ? Many thanks in advance, -arifi . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think you'll have to put that file under XLStart folder
(Excel automatically loads the files there at start-up) on every machine. -----Original Message----- Hi... Again, thanks for the information below. Now the question has taken a different form though. As I understand, the mechanisms I implement similar to the ones below exist in the workbook they are defined in only (as expected). But, what I need to have is that the mechanism I implement will be available vor every excel worksheet opened in the company. Is there a mechanism to create a "master" or whatever excel file to be installed on everyones PC that will incorporate my stuff into their excel sessions ? TIA,A -arifi "Serkan" wrote in message ... This one prevents people from all ways of cutting/copying and pasting when your workbook is open. I think you can derive what you need from that... Run DisableCutAndPaste from a suitable event procedure (e.g. Workbook_Open or Worksheet_Activate) and EnableCutAndPaste from another (e.g. Workbook_Close or Worksheet_Deactivate). Sub DisableCutAndPaste() EnableControl 21, False ' cut EnableControl 19, False ' 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 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 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 -----Original Message----- Hello everyone, Quite new to VBA etc stuff (but not new to programming), I am looking on ways to catch a user's copy/cut + paste command from all possible locations (edit menu, keyboard shortcuts, other if any (are there others?), then do some modifications in the cells being copied/moved and then paste to wherever the user wanted to copy the stuff. How do I do that ? Many thanks in advance, -arifi . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
Copy, paste without file name referenced after paste | Excel Discussion (Misc queries) | |||
Copy; Paste; Paste Special are disabled | Excel Discussion (Misc queries) | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
I cannot paste from one workbook to another. Copy works, paste do. | Excel Discussion (Misc queries) |