Quote Originally Posted by mikerickson View Post
This will get the code from an Excel module, open Word, create a new document and put that code into the new document.
Word should not be open when you run this.
Only if you have a code module named 'Module1' and only for that code module. If there's no 'Module1' (e.g. because all the code is in the 'ThisWorkbook' module, a sheet module or a userform), all you'll get is an error message.

It shouldn't matter whether Word is open, but what does matter is:
• you also need to give trusted access to the VBA project model or the code won't work;
• your code doesn't save the document; and
• your code leaves an orphaned Word session containing the unsaved document running in the background.