Click here to Skip to main content
15,122,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have word template files in .dot or .dotx format. I need to keep them in this format.
What I am trying to do is when the document opens have vba code or something else that executes some logic and based on that logic opens the file normally or in another condition opens a blank word .dot or .dotx file. Actually it doesn't need to even open a blank file it can not open the file at all. The issue is that these templates are opened from out ERP System so I don't have the ability to change how these files are opened..

What I have tried:

I have googled the heck out of this for a solution but I was unsucessful
Posted
Updated 16-Dec-20 4:24am
Comments
BabyYoda 16-Dec-20 9:12am
   
A Word template file can have VBA code but I don't quite follow what you are wanting to do exactly.
John Robert Connolly 16-Dec-20 9:14am
   
I thought that word .dot and .dotx files can't have vba code?
CHill60 16-Dec-20 9:26am
   
You need to use the "Reply" link to reply to comments, otherwise the poster is not notified. The comment from BabyYoda in not entirely correct

1 solution

If you attempt to save any VBA code in a non-macro enabled type for any Office document you will get an error. The file can still be saved, but not with the macros.
You have very few choices
1. Not have any macros
2. Save in the latest version of a macro-enabled type i.e. .dotm
3. Save in "Word 97-2003 Template" format i.e. .dot - Not recommended, just pointing out that it will work

If the ERM system can open either .dot or .dotx surely it can handle .dotm? Isn't it just file association settings? I can double click on any of these and get the default app (Word) to open them without changing any other settings
   
Comments
Maciej Los 16-Dec-20 9:31am
   
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900