xCav8r
02-24-2006, 02:58 PM
I couldn't think of a more descriptive title. http://vbaexpress.com/forum/images/smilies/119.gif
I have a group of approximately 100 people who are converting from Word Perfect to Word. They will be using MS Word templates created by a small group of people with no knowledge of (or desire to know) VBA. Many of these templates will use Word's formfield controls (user's choice), and the templates will be saved with protection without a password. I have been asked to provide a few macros that the templates can use?namely inserting the current date to a specially named formfield on document_new, spell checking protected forms, and unlinking form fields. Other things may be added in the future, so I chose to place the macros in a few modules in a template called "templatemacros.dot", which is stored in a read-only directory on a server to which the 100+ users are pointing via their startup paths. The idea is to make future distribution of the code as simple as possible and not burden the template creators with the need to adjust their security settings or think about storing these templates in trusted locations.
I instructed the template creators to add two custom document properties to their templates to enable the use of the macros. The first property is called "ShowMenu". I've been trapping DocumentChange to look for the custom property and, if found, display a pop-up tacked onto the end of the Menu Bar. The pop-up, which is stored in the template containing these macros, has two buttons pointing to the routines that unlink the fields and spell check protected forms, respectively. The second property is called "InsertDate". I'm trapping the document_new to look for this property and, when found, to insert the date to the desired field.
Everything works as planned except for one frustrating thing. I'm displaying the pop-up by turning its visibility on and off, but whenever a user quits Word, he or she is prompted to save changes to "templatemacros.dot". Changing the visibility in the pop-up, which is stored in "templatemacros.dot" is causing the prompt to appear. That won't work with a template that's in a read-only directory?not to mention that the file is locked whenever anyone pointing to it via their startup path has Word open.
As a workaround, I've considered creating and deleting the pop-up and corresponding buttons in each user's "normal.dot". I always have bad luck with my "normal.dot" getting corrupted in some way?especially following modifications to commandbars?so I'm concerned that constantly editing each user's "normal.dot" might accelerate the demise of their files. Perhaps this is an unwarranted concern.
I hope that provides enough background to ask these questions:
Given what I'm trying to do, is there a better way to accomplish the end result? (Sometimes I can't see the forest.)
If storing the code, pop-up, and corresponding buttons in a global template is as good as any other approach, is there a way to prevent the prompt to save without resorting to changes to the "normal.dot"?
Am I unnecessarily concerned with the "normal.dot" becoming corrupted?
I have a group of approximately 100 people who are converting from Word Perfect to Word. They will be using MS Word templates created by a small group of people with no knowledge of (or desire to know) VBA. Many of these templates will use Word's formfield controls (user's choice), and the templates will be saved with protection without a password. I have been asked to provide a few macros that the templates can use?namely inserting the current date to a specially named formfield on document_new, spell checking protected forms, and unlinking form fields. Other things may be added in the future, so I chose to place the macros in a few modules in a template called "templatemacros.dot", which is stored in a read-only directory on a server to which the 100+ users are pointing via their startup paths. The idea is to make future distribution of the code as simple as possible and not burden the template creators with the need to adjust their security settings or think about storing these templates in trusted locations.
I instructed the template creators to add two custom document properties to their templates to enable the use of the macros. The first property is called "ShowMenu". I've been trapping DocumentChange to look for the custom property and, if found, display a pop-up tacked onto the end of the Menu Bar. The pop-up, which is stored in the template containing these macros, has two buttons pointing to the routines that unlink the fields and spell check protected forms, respectively. The second property is called "InsertDate". I'm trapping the document_new to look for this property and, when found, to insert the date to the desired field.
Everything works as planned except for one frustrating thing. I'm displaying the pop-up by turning its visibility on and off, but whenever a user quits Word, he or she is prompted to save changes to "templatemacros.dot". Changing the visibility in the pop-up, which is stored in "templatemacros.dot" is causing the prompt to appear. That won't work with a template that's in a read-only directory?not to mention that the file is locked whenever anyone pointing to it via their startup path has Word open.
As a workaround, I've considered creating and deleting the pop-up and corresponding buttons in each user's "normal.dot". I always have bad luck with my "normal.dot" getting corrupted in some way?especially following modifications to commandbars?so I'm concerned that constantly editing each user's "normal.dot" might accelerate the demise of their files. Perhaps this is an unwarranted concern.
I hope that provides enough background to ask these questions:
Given what I'm trying to do, is there a better way to accomplish the end result? (Sometimes I can't see the forest.)
If storing the code, pop-up, and corresponding buttons in a global template is as good as any other approach, is there a way to prevent the prompt to save without resorting to changes to the "normal.dot"?
Am I unnecessarily concerned with the "normal.dot" becoming corrupted?