Thread: Checkbox code
View Single Post
 
Old 07-09-2020, 12:35 AM
Guessed's Avatar
Guessed Guessed is online now Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,984
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

OK, this line is probably erroring because it doesn't have a document path or the named file doesn't exist in that document path.

Why might a document not have a document path? If you double click on a template (dotx or dotm file), Word creates a brand new document which hasn't yet been saved - and therefore it doesn't have a folder path.

If you hover over ThisDocument.Path, does it show a valid path? If it does, look in that folder to verify the named file exists there (the Message Cover file)

Generally, I would recommend that you put the two templates in a folder that the users can access - you don't need a docm file if you put the code inside a dotm template. If they create a new docx file by double clicking the dotm file then when they save the document, the template path will be saved as the 'Attached Template' so they will still have access to the macros and the Building Blocks. Your code could then make use of the template location for the email cover by either using ThisDocument.Path (the file the code is running from) or ActiveDocument.AttachedTemplate.Path (the path where the attached template is saved).
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote