Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-26-2017, 04:31 AM
ShogunPatch ShogunPatch is offline Calling up a userform whenever a new document is created Windows 10 Calling up a userform whenever a new document is created Office 2016
Novice
Calling up a userform whenever a new document is created
 
Join Date: Sep 2017
Posts: 1
ShogunPatch is on a distinguished road
Default Calling up a userform whenever a new document is created


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.
 

Tags
autoexec, userform



Similar Threads
Thread Thread Starter Forum Replies Last Post
export UserForm created strings to generated Document from template Trainee Word VBA 2 09-13-2017 02:29 AM
Calling up a userform whenever a new document is created Calling Sub Routine for Formatting recently Created Word Document rpb925 Word VBA 12 03-31-2016 03:14 AM
Adding tables to Created word document whilst other word document open Help rpb925 Word VBA 18 03-30-2016 04:45 PM
Insert an image to a document created by a userform? jgoodrich Word VBA 0 10-22-2014 11:03 AM
Calling up a userform whenever a new document is created Is it possible to take an input from a UserForm in one document to a UserForm in a do BoringDavid Word VBA 5 05-09-2014 09:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:54 AM.


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