Compile error: Invalid Outside Procedure

Anonymous
2022-08-10T21:49:04+00:00

<Moderator moved from Windows to Mac because Parallels is involved>

I recorded an "Insert Text From File" macro that gets the following error message when I attempt running it: "Compile error: Invalid Outside Procedure".

The VBA code is as follows (with an arrow pointing to the "Sub Macro8()" line, and highlighted in yellow):

Sub Macro8()

'

' Macro8 Macro

'

'

Selection.InsertFile FileName:="Test1.docx", Range:="", ConfirmConversions \_

    :=False, Link:=False, Attachment:=False

Please help!

Microsoft 365 and Office | Word | For home | MacOS

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
{count} votes

18 answers

Sort by: Most helpful
  1. Jim G 134K Reputation points MVP Volunteer Moderator
    2022-08-15T16:02:06+00:00

    Some code must be running or intercepting your typing.

    Try the command in a new, blank document.

    0 comments No comments
  2. Anonymous
    2022-08-19T00:02:14+00:00

    Still not working :(

    0 comments No comments
  3. Jim G 134K Reputation points MVP Volunteer Moderator
    2022-08-19T19:42:34+00:00

    Since the problem applies to Word for Windows, I suggest starting a new question in the Word for Windows forum and ask about what could cause CurDir to fail.

    0 comments No comments