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

How can I stop users from using Copy/Paste in any application while my macro
is running?

Or, can I use an isolated clipboard that's only available to Excel and Word
and it's not affected by what users copy in other applications?

Regards,
Richard


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

You cannot stop users from copying/pasting in other apps via a macro
in excel or word. But you can disable copy/paste in excel via macro..
see below:

The code below must be placed in the Private Module of the Workbook
Object (ThisWorkbook). To get there easily, right click on the Excel
icon, top left next to File and choose View Code. In here paste the
code below, close & save and then re-open.

Private Sub Workbook_Activate()
Dim oCtrl As Office.CommandBarControl

'Disable all Cut menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = False
Next oCtrl

'Disable all Copy menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = False
Next oCtrl

Application.CellDragAndDrop = False

End Sub

Private Sub Workbook_Deactivate()
Dim oCtrl As Office.CommandBarControl

'Enable all Cut menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = True
Next oCtrl

'Enable all Copy menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = True
Next oCtrl

Application.CellDragAndDrop = True

End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
With Application
.CellDragAndDrop = False
.CutCopyMode = False 'Clear clipboard
End With
End Sub
List of Excel 2000 CommandBar Button IDs applies to excel 97 onwards.

Found he http://www.ozgrid.com/VBA/disable-cut-copy.htm

On Aug 14, 3:41 pm, "Richard" wrote:
How can I stop users from using Copy/Paste in any application while my macro
is running?

Or, can I use an isolated clipboard that's only available to Excel and Word
and it's not affected by what users copy in other applications?

Regards,
Richard



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

This doesn't account for doing the copy/cut and pasting by keyboard method.
There are 2 different keyboard combinations for each of the copying (Ctrl-C
and Ctrl-Insert), cutting (Ctrl-X and Shift-Del) and pasting (Ctrl-V and
Shift-Insert). Note, the first set of the 2 keyboard combination sets is
from the older Mac command keyboard combinations while the second set is the
older 3.1 and previous Windows keyboard combinations.

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000

"KLZA" wrote in message
ups.com...
You cannot stop users from copying/pasting in other apps via a macro
in excel or word. But you can disable copy/paste in excel via macro..
see below:

The code below must be placed in the Private Module of the Workbook
Object (ThisWorkbook). To get there easily, right click on the Excel
icon, top left next to File and choose View Code. In here paste the
code below, close & save and then re-open.

Private Sub Workbook_Activate()
Dim oCtrl As Office.CommandBarControl

'Disable all Cut menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = False
Next oCtrl

'Disable all Copy menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = False
Next oCtrl

Application.CellDragAndDrop = False

End Sub

Private Sub Workbook_Deactivate()
Dim oCtrl As Office.CommandBarControl

'Enable all Cut menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = True
Next oCtrl

'Enable all Copy menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = True
Next oCtrl

Application.CellDragAndDrop = True

End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
With Application
.CellDragAndDrop = False
.CutCopyMode = False 'Clear clipboard
End With
End Sub
List of Excel 2000 CommandBar Button IDs applies to excel 97 onwards.

Found he http://www.ozgrid.com/VBA/disable-cut-copy.htm

On Aug 14, 3:41 pm, "Richard" wrote:
How can I stop users from using Copy/Paste in any application while my
macro
is running?

Or, can I use an isolated clipboard that's only available to Excel and
Word
and it's not affected by what users copy in other applications?

Regards,
Richard





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

This would be really tough to disable as the copying and pasting is done not
just to MS Office programs, but for all programs on the system. Also, if
your program is ran in the background and the user is working on other
items, would you really want this disabled to the point that the user can't
do any sort of copying and pasting with other apps? I could just see how
other users would view this, so be very careful about this.

The more idea solution, which I have had to use within my production
reporting system, though also has some draw backs similar to your situation,
first avoid using the "Copy" method as "Reasonably" possible, but rather
take values directly from one cell to another cell, which works okay for
smaller ranges, but may be a time lagger for larger ranges. Once this is
done, then for those larger ranges, use the DestinationRange argument within
the Copy method of the SourceRange object. Right after that takes place,
let the CutCopyMode property on the Application object to "False".

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000

"Richard" wrote in message
...
How can I stop users from using Copy/Paste in any application while my
macro is running?

Or, can I use an isolated clipboard that's only available to Excel and
Word and it's not affected by what users copy in other applications?

Regards,
Richard



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Disable Copy/Paste

You have a good point, disabling copy/paste may not be ideal.

What about this:
Can I use an isolated clipboard that's only available to Excel and Word and
it's not affected by what users copy in other applications?

"Ronald Dodge" wrote in message
...
This would be really tough to disable as the copying and pasting is done
not just to MS Office programs, but for all programs on the system. Also,
if your program is ran in the background and the user is working on other
items, would you really want this disabled to the point that the user
can't do any sort of copying and pasting with other apps? I could just
see how other users would view this, so be very careful about this.

The more idea solution, which I have had to use within my production
reporting system, though also has some draw backs similar to your
situation, first avoid using the "Copy" method as "Reasonably" possible,
but rather take values directly from one cell to another cell, which works
okay for smaller ranges, but may be a time lagger for larger ranges. Once
this is done, then for those larger ranges, use the DestinationRange
argument within the Copy method of the SourceRange object. Right after
that takes place, let the CutCopyMode property on the Application object
to "False".

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000

"Richard" wrote in message
...
How can I stop users from using Copy/Paste in any application while my
macro is running?

Or, can I use an isolated clipboard that's only available to Excel and
Word and it's not affected by what users copy in other applications?

Regards,
Richard







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
Disable copy paste option on a particular cell Dileep Chandran Excel Worksheet Functions 0 November 13th 06 05:28 AM
Disable Copy, Cut & Paste - First Post del8oy78 Excel Programming 0 May 12th 06 11:07 AM
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


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