Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-09-2020, 12:35 AM
Guessed's Avatar
Guessed Guessed is offline Checkbox code Windows 10 Checkbox code Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox code Check Boxes Not Displayed via MailMerge CheckBox Insertion code JennEx Mail Merge 2 05-28-2019 05:55 PM
Checkbox code One Content Control Checkbox checks another Content Control Checkbox DEsh Word VBA 2 10-06-2017 08:23 PM
Copy ActiveX-Checkbox with code DanielM125 Word VBA 0 06-04-2015 12:49 AM
Checkbox code Uncheck Checkbox Code not working if document protected bandrist Word VBA 2 08-14-2013 09:02 AM
Excel ->VB code for Checkbox (control toolbox) kirkstyle Excel 0 08-16-2006 04:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:12 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft