Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to catch copy/paste & cut/paste ?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to catch copy/paste & cut/paste ?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to catch copy/paste & cut/paste ?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to catch copy/paste & cut/paste (New Dimension) ?

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   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How to catch copy/paste & cut/paste (New Dimension) ?

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
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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy, paste without file name referenced after paste AusTexRich Excel Discussion (Misc queries) 6 September 23rd 08 02:57 AM
Copy; Paste; Paste Special are disabled Mack Neff[_3_] Excel Discussion (Misc queries) 0 April 28th 08 06:29 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM


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