They all have the same problem. Could the issue relate to the fact that I'm using Parallels?
Compile error: Invalid Outside Procedure
<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.
18 answers
Sort by: Most helpful
-
Anonymous
2022-08-11T18:38:52+00:00 -
Jay Freedman 205.9K Reputation points Volunteer Moderator2022-08-11T19:08:48+00:00 They all have the same problem. Could the issue relate to the fact that I'm using Parallels?
It's possible, but I can't test that because I don't have a Mac. I'm going to change this thread's metadata to say Mac instead of Windows so the Mac volunteers will see it.
-
Jim G 134K Reputation points MVP Volunteer Moderator2022-08-12T20:31:21+00:00 If you are running Excel for Windows in Parallels, then everything that applies to Excel for Windows is in play, and nothing particular to Excel for Mac is involved.
I testing the code in Word for Mac. The code fails unless you use the full file path. When I used the full file path, the code ran to completion as expected. I can't guarantee this is the case with Word for Windows, but I suspect not using the full file path is the likely cause of your error.
-
Doug Robbins - MVP - Office Apps and Services 322K Reputation points MVP Volunteer Moderator2022-08-12T20:34:46+00:00 As Jim has said, you will need to include the path to the file that you are inserting.
-
Anonymous
2022-08-12T20:53:10+00:00 To clarify, if the full path is x:\sig.docx, then I would manually add in the "x:" so that it's changed to: Selection.InsertFile FileName:="x:\Test1.docx"?
The path is short because I'm doing through Parallels, and there's a shortcut to the folder on the Mac system through that drive.