Clear Excel Clipboard Using VBA in 64-Bit Excel
Question details
The user wants to clear the Excel or Windows clipboard history using VBA in a 64-bit Excel environment but found that recorded or standard commands do not work as expected.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Writing a VBA macro to clear the clipboard history or cancel the active copy/cut mode in 64-bit Excel.
- Observed behavior
- Standard recorded macro commands fail to clear the Windows clipboard history in 64-bit Excel, leaving items in the clipboard.
Ensure you have enabled the Developer tab in your spreadsheet software and saved your workbook as a Macro-Enabled Workbook (.xlsm) before running VBA code.
Cancel Excel's Copy/Cut Mode using Application.CutCopyMode
Use this method to quickly remove the moving border around copied cells and cancel Excel's internal clipboard state.
The easiest way to clear Excel's active selection clipboard is by setting the CutCopyMode property to False. Note that while this stops Excel from pasting the current selection, it does not necessarily wipe the system-wide Windows clipboard history.
Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the Project Explorer pane on the left, right-click on your workbook name, select 'Insert', and then click on 'Module'.
Type the following code into the module window: Sub ClearExcelClipboard() Application.CutCopyMode = False End Sub
Press F5 or click the Run button in the toolbar to execute the macro. The moving border around any copied cells in your worksheet will disappear.

Clear the Full Windows Clipboard using 64-Bit Windows API
Use this method if you need to completely empty the Windows system clipboard history via VBA in a 64-bit environment.
Use VBA in WPS Spreadsheet to Manage Macros Easily
WPS Office offers robust VBA support in its Spreadsheet application, allowing you to write, edit, and run macros just like in Microsoft Excel, including clipboard management commands.
- 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook in the Spreadsheet application.
- 2. Access the Developer Tab: Navigate to the Developer tab on the top ribbon and click on 'VBA Editor' to launch the macro environment.
- 3. Run Your Clipboard Macro: Insert a new module, paste your Application.CutCopyMode = False script, and run it to clear the active copy mode instantly.

Frequently Asked Questions
Why doesn't Application.CutCopyMode = False clear the Windows clipboard history?
This command only cancels Excel's internal active copy or cut state, which is represented by the moving border around selected cells. It does not communicate with the system-wide Windows clipboard manager (accessed via Win + V).
How do I make Windows API clipboard commands work in 64-bit Excel?
In 64-bit versions of Excel, you must update your API declarations by adding the 'PtrSafe' keyword (e.g., Declare PtrSafe Function...) and updating pointer variables to 'LongPtr' instead of 'Long' to ensure compatibility with 64-bit memory addressing.
Does WPS Office support running 64-bit VBA macros?
Yes, the VBA editor in WPS Office supports standard macro scripts used in Microsoft Excel. You can seamlessly run your existing macros, including those utilizing Windows API and clipboard management commands.




