![]() |
|
#9
|
|||
|
|||
|
Here is a macro that, if placed in a macro enabled template, will create a new document based on the template and close the template if someone opens the template.
Code:
Sub AutoOpen()
' Prevent opening of template with macros active
' Creates a new document based on the template instead of opening the template
' 24 January 2019
' Charles Kenyon
'
If ActiveDocument.Name = ThisDocument.Name Then
Documents.Add (ThisDocument.FullName)
ThisDocument.Close SaveChanges:=False
End If
End Sub
I've attached such a template. Note, to open such a template for editing, you must hold down the Shift key when opening it. It would need to be stored in a trusted location such as the Workgroup Templates folder. If you place it somewhere not OK'd for macros, then it will open ordinarily and if macros are enabled, the macro would run. |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Custom Template, Multi-List Heading Numbers Reverting to Template Rather than Keeping Local Change
|
whsnow | Word | 2 | 03-24-2018 06:57 AM |
Multi-User Authoring
|
jimbassett | Word | 1 | 03-26-2015 11:52 PM |
| Multi-user authoring | jimbassett | Excel | 0 | 03-26-2015 10:13 PM |
Office Multi User Licence
|
JamesT1 | Office | 4 | 05-23-2011 06:19 AM |
| Merge to New Document - saved letter continues to ask for SQL source | Brandi | Mail Merge | 2 | 06-16-2010 08:08 AM |