Forum Discussion

gjameric2090's avatar
gjameric2090
Copper Contributor
May 03, 2024

How to share a dotm file with VBA with design mode off

Hello all, 

 

I have created a tool using word and VBA where a user selects the name of a company and it creates a letterhead based on data in an excel sheet. 

 

Briefly, there are three files involved. 

 

1) The creator tool - a word document with a create letterhead button which loads the name of the companies from an excel sheet

2) The company data excel sheet which the creator tool uses to find the company name and the other associated information that then gets passed to 

3) The master template word file - which is used to define where each piece of information from the excel sheets go. 

 

The users interact with the creator tool and end up with a new document with the right letterhead and address in it. 

 

All of the users of the tool are in the same organisation using M365. Users install the tool by copying two files to the C drive and the creator file to their desktop.

 

The issue arises when the user opens the creator word document for the first time. Unfortunately I can't seem to find a way to prevent the document from opening with Design mode switched on, which makes the button on the document inactive. 

 

I'm looking to simplify the rollout without users having to enable the deliver ribbon, turn off design mode and then save - so any tips would be appreciated!

Thanks!

  • gjameric2090 Files 1 and 3 should be combined into a single Macro Enabled Template with code in an AutoNew macro (or Document New Event) that displays a UserForm that contains a dropdown control that is populated with the data from the Excel Resource and any other controls that might be necessary for the process.  

     

    The Macro Enabled Template should be stored in the user's Template folder and they would use FIle>New and select that template when they need to create a new "letter head" document.

     

    The Excel file will need to be stored in a location that is available to all users, or if you are going to located that on each users machine, you may need a routine for the users to browse to and select that file the first time they use the system and that have the full path of the file stored in the registry from where it would be obtained on subsequent uses.

     

    See the following pages of Greg Maxey's website :

    http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm

    http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm

     

     

  • gjameric2090 Files 1 and 3 should be combined into a single Macro Enabled Template with code in an AutoNew macro (or Document New Event) that displays a UserForm that contains a dropdown control that is populated with the data from the Excel Resource and any other controls that might be necessary for the process.  

     

    The Macro Enabled Template should be stored in the user's Template folder and they would use FIle>New and select that template when they need to create a new "letter head" document.

     

    The Excel file will need to be stored in a location that is available to all users, or if you are going to located that on each users machine, you may need a routine for the users to browse to and select that file the first time they use the system and that have the full path of the file stored in the registry from where it would be obtained on subsequent uses.

     

    See the following pages of Greg Maxey's website :

    http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm

    http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm

     

     

Resources