Run-time error '5': Invalid procedure call or argument when Running Macros in Microsoft Word
  • 09 Jan 2024
  • Contributors
  • Dark
    Light
  • PDF

Run-time error '5': Invalid procedure call or argument when Running Macros in Microsoft Word

  • Dark
    Light
  • PDF

Article summary

When running macros in Word, the following error occurs:

'Run-time error '5': Invalid procedure call or argument'

Answer:

This was due to the header having not been added as a merge field. After adding the header, you will need to hit Alt F9 and make sure its a merge field.

If you hit Alt F9 and the header does not toggle to show merge field, then you will need to add each merge field manually and then save the template after. Typically you will not have to do that, but sometimes it is necessary.

How to add Header Coding as a Merge Field in Microsoft Word Templates
How to Create and Run Grant Letters in Microsoft Word
How do I Create and Run Gift Acknowledgement Letters?
How do I save Gift Acknowledgements, Fund Statements, and Grantee Correspondence to Profile or Fund Folders?
How to Create Fund Statements in Microsoft Word

If you have verified that all of the fields in the header show as a merge field when toggling Alt F9 and the issue still occurs, this can be caused by formatting in the template itself such as inserted objects that cause the macro to not be able to read the document. These objects will need to be deleted.

An example of what an object looks like is below. Note the object anchor on the left, the layout properties on the right and in the middle, the main object window  

that was inserted.



Was this article helpful?