When you run a recorded macro that contains copy and paste commands, you may receive the following error message:
Microsoft Visual Basic
Run-time error '1004':
Paste method of Worksheet class failed
↑ Back to the top
This error message occurs when you do the following:
- You start the macro recorder and you cut or copy items.
-and-
- You paste using the Clipboard toolbar.
↑ Back to the top
When recording macros, do not use the Clipboard toolbar to cut, copy or paste items. Instead use the Cut, Copy and Paste buttons on the Standard toolbar or the Edit menu.
↑ Back to the top
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
↑ Back to the top
When you perform multiple copy commands in any of the Microsoft Office programs, the Clipboard toolbar appears, allowing you to collect and paste multiple items stored in the toolbar. For example, you can copy a chart in Excel, switch to Microsoft Word and copy text, and then switch to Microsoft PowerPoint and paste all of the collected (cut or copied) items from the Office Clipboard.
However, because the Office Clipboard is not included in the Visual Basic for Applications object model, it is not a programmable object in Excel. Therefore, the macro recorder does not recognize actions performed with the Office Clipboard.
↑ Back to the top
For more information about the Office Clipboard, click Microsoft Excel Help on the Help menu, type About collecting and pasting multiple items in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
↑ Back to the top