Share via

Condition: Paste command stops working in one document only.

Anonymous
2022-12-02T22:41:01+00:00

Good day! Running: Windows 10, working with Office (version 18.2210.1203.0) in a macro-enabled Word document. I use tables very regularly, just for home projects. i also use macros a lot to perform regular operations. Everything works fine, I have some pretty complex macros! However, all of a sudden, the paste command will stop working, in ONE PARTICULAR DOCUMENT only, after running a macro. pasting manually sometimes works unless i run the 'debug' function. The copied item does appear on the clipboard but will not paste, in any format, by any method. I have tried: exiting and re-opening the document, clearing the clipboard, re-starting the pc, repairing and resetting Office in 'settings/apps/apps and features/office/advanced options'. All with no success. The copy / paste commends continue to work fine in all other documents. This happened once before, I ended up having to do a complete reset of my laptop to fix the problem. Should I try re-installing office? Should I try Windows 11?

The error message is 'Run-time error "4198" Command Failed'

I should mention ha I have learned to make and use macros completely by trial and error. I can edit and even write out commands successfully, but I really don' understand visual basic, including basic fundamentals such as an "argument".

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Jay Freedman 207.7K Reputation points Volunteer Moderator
    2022-12-03T02:28:14+00:00

    When something works everywhere except one document, the problem is most likely in that document, not in the program or the operating system. A "Command Failed" error is Microsoft's catch-all for "the thing you're trying to paste can't be put into the document at the place where you're trying to put it, but I don't know exactly why".

    The investigation goes something like this:

    • Try manually pasting different things at the same place in the document.
    • If that works, maybe the problem is the clipboard's content during the macro run. Using the Debug menu in the macro editor, set a breakpoint to stop after the item is copied but before it's pasted; then switch to the document body and try manually pasting.
    • If the error occurs then, try pasting the clipboard content into a new blank document. Exactly what is in it, including nonprinting characters (show with the ¶ button on the Home ribbon)?
    • It may also help to know exactly where in the document the macro "thinks" it's pasting. Insert a statement to select the pasting location and then stop executing. Where in the document is the selection?

    If you can determine what conditions cause the error -- an invalid character on the clipboard, or trying to paste a control inside another control, or some other mismatch of the clipboard item and the document content -- then you should add code to the macro to avoid trying to do that.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments