Greetings all.
I'm new to this forum and pretty new to Word macro programming to please bear with me...
I have developed a custom macro-enabled building blocks template ("MyBuildingBlocks") which, in addition to various standard document components, includes a number of userforms which are designed to guide the user to insert the correct building block to start his document with;
- The primary form ("frmTemplateOptions") asks users to select a category of document using radio buttons. Then depending on the option chosen;
- The correct one of a choice of secondary userforms ("frmOptionA", "frmOptionB", "frmOptionC", etc) is called up asking users to select a specific document from within the selected type, again using buttons;
- Finally, the relevant building block is inserted according to the selection made.
Referring to various articles online, I have created a macro ("CallUF_TemplateOptions") within a module ("modTemplateOptions") in MyBuildingBlocks with which I can successfully call up the primary userform. This then correctly takes me through my selection options and inserts the required building block.
If I start Word and manually call up the primary userform using this macro, everything seems to work fine. My problem is that I want the primary userform to flash up automatically every time I create a new document (i.e. open word for the first time as it is set to open a new doc automatically, or press Ctrl +N, click on the New Document icon on the QAT, etc). I do not want it to come up if I open up an existing document (either when I chose file/open from within word, or if I right-click on the Word icon in the start bar and then choose an existing document).
I've managed to get halfway there by adding some code to a public AutoExec sub in a second module ("modLaunchPrimaryForm"). This successfully calls up the form when I first open word, but:
- If I create another new document from within Word it does not launch
- If I open an existing document it launches and I have to cancel before the exisitng document opens up
I suspect this is really simple if you know what you're doing - which I clearly don't - so any pointers to help me get on the right track would be much appreciated.