logo
search
VBA & Macro Problems

Clear Excel Clipboard Using VBA in 64-Bit Excel

Camila MilosovichCamila Milosovich Sep 28, 2026 869 views

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.

How to Clear the Excel Clipboard with VBA in 64-Bit Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.

2
Insert a New Module

In the Project Explorer pane on the left, right-click on your workbook name, select 'Insert', and then click on 'Module'.

3
Enter the CutCopyMode Command

Type the following code into the module window: Sub ClearExcelClipboard() Application.CutCopyMode = False End Sub

4
Run the Macro

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.

Cancel Excel's Copy/Cut Mode using Application.CutCopyMode
Scope of Application.CutCopyMode: This command only affects Excel's internal copy/cut status. Items previously copied to the Windows clipboard (Win + V) will still be accessible.
Free Microsoft Office alternative

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. 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook in the Spreadsheet application.
  2. 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. 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.
Highly compatible with Microsoft Excel (.xlsm) macro filesSupports standard VBA syntax including Application.CutCopyModeLightweight architecture for fast macro executionFamiliar user interface for seamless migration
QA img-9

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.