Controlling saving templates

  • Thread starter Thread starter deb_dolittle
  • Start date Start date
D

deb_dolittle

I created a Word form template (Version 2003 on an XP, if that
mattters) that will be used by sevaral members in my company. It has a
fill in fields only protection.When I go to the directory that the
template is in and double click the template, it opens up as a document
and any changes get saved as a document. This is good. But should a
user open the template from the file menu within Word and fill it out
and save it, it saves it as a template. Not good. Is there anyway I can
prevent the template itself from getting saved when the protection is
on, no matter how it is opened up? I have little control how the user
opens the template.

Thanks

Debbie
 
Put this macro into your template
(http://www.gmayor.com/installing_macro.htm).

Sub AutoOpen()
Dim msg As String
If ActiveDocument.Type = wdTypeTemplate Then
msg = "You have opened the template" & vbCr
msg = msg & ActiveDocument.Name & vbCr
msg = msg & "instead of creating a new document "
msg = msg & "based on the template." & vbCr & vbCr
msg = msg & "If you really want to edit the "
msg = msg & "template itself, hold down the "
msg = msg & "Shift key while opening it."
MsgBox msg, vbCritical + vbOKOnly, "WARNING!"

ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
End If
End Sub

If anyone opens the template itself, they'll see the message box, and then
the template will close itself.

If they use the File > New menu item or just double-click the template's
icon to get a new document, the If statement's condition will be false and
the document will behave normally.

If you follow the instructions and hold down the Shift key while opening the
template, that prevents the auto macro from running. Then you can --
intentionally -- modify the template.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top