This site will look better if you upgrade to a browser that supports web standards.
This site will look better if you upgrade to a browser that supports web standards.
In Windows XL versions, calling Application.CutCopyMode = False will clear the XL clipboard (which is ideosyncratic to XL in that certain operations clear the clipboard automatically, and some don't, without a whole lot of predictability).
The Mac clipboard, however, is persistent - when you set the CutCopyMode to False in MacXL, the "marching ants" border surrounding the copied cell(s) goes away, but the contents are retained on the clipboard. This can cause occasional problems when trying to limit the user's ability to copy and paste data.
If you need to clear the clipboard from XL, you can do so using a DataObject that contains a null string. This function will clear the clipboard and set the CutCopyMode to False:
Public Function ClearMacClipBoard() As Boolean 'Clear the Mac Clipboard - J.E. McGimpsey 'http:www.mcgimpsey.com/macoffice/excel/clearclipboard.html Dim myDO As DataObject On Error GoTo EndCMCB Set myDO = New DataObject myDO.SetText "" myDO.PutInClipboard Application.CutCopyMode = False ClearMacClipBoard = True EndCMCB: On Error GoTo 0 End Function
Call this as with any function from VBA. A return value of True will indicate that the clipboard is clear.
This page last updated
© Copyright 2001 - 2004 McGimpsey and Associates. Except where noted, all code on this site may be distributed under the Gnu GPL. Acknowledgement is appreciated.
Unfamiliar with macros? See David McRitchie's Getting Started With Macros and User Defined Functions