PDA

View Full Version : Word 16 on macOS 12.6 (M1 chip) cannot find template



mansky
04-30-2023, 06:51 AM
Hi all,

I have several macros that I used, via shortcut keys defined in AutoExec of Normal, to open a new document based on a custom template I have saved in
the same folder as AutoExec.

These macros have worked fine on Office X, Office 2004 and 2011 (both PPC and intel-based Macs).
On a new laptop with an M1 chip I get Error #4198 cannot find the requested file or folder.

I have all the macros and the templates installed in the default location for Word 16:


Macintosh HD:Users:" & TheUser & ":Library:Group Containers:UBF8T346G9.Office:User Content:Templates:ERI Templates:

where TheUser is the specific User on the laptop using Word.

The code snippet is:



TmpPath = "Macintosh HD:Users:" & TheUser & ":Library:Group Containers:UBF8T346G9.Office:User Content:Templates:ERI Templates:"
TmpName = "VM_Notes.dotm"

Application.ScreenUpdating = False
Documents.Add Template:=TmpPath & TmpName, DocumentType:=wdNewBlankDocument, Visible:=True


The Documents.Add method is the command that is failing.

The permissions on the template, and the enclosing folders is correct, the User has read/write and execute privileges.

Any idea what I need to do to get Word 16 to execute the Documents.Add method from a Macro?
I can create a new document based on the same template via the Gallery, by hand.

Thanks,

--Ed

mansky
05-20-2023, 10:46 AM
SOLVED:

The problem was the path delimiter and the root disc name.

Replacing : with forward slash (/) resolved the problem.

The corrected code snippet is:


TmpPath = "/Users/" & TheUser & "/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Templates.localized/ERI Templates/"
TmpName = "NumberedHeadings.dot"


Also the explicit naming of the disc the template is located on is also dropped. Replacing "Macintosh HD" with "/" was also needed.

I haven't seen this change documented at any of the VB MS sites.

Aussiebear
05-20-2023, 02:56 PM
Thank you for putting your solution up.