I've been asked to write some procedures for my company, and they require the use of forms. When I sent the work to my boss for comment, he said in effect, "Hey, this has gotten 'way out of control. The forms are nice, but no one's going to go through the rigmarole of installing special templates to use them."
Gee. OK. We need forms, but we don't want templates. Is there a way to do that?
One possibility I thought of is an installer that automatically puts the templates in the right place. I think it would have to be written in VBA to find the right directory without a great deal of work. If anyone has tried this, how did it work out?
Last edited by jsachs177; 2011-11-23 at 11:50.
Subscribe to get a FREE chapter from Windows 7 The Missing Manual
This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
Word templates do offer some features you can't get with a Word document. I think particularly of a template's ability to store AutoText, and its ability to supply macro functionality without having them embedded in the document (which can cause alarm bells to ring in Word). If you don't need these feature, then a document will do just as well -- assuming users don't accidentally overwrite it.
For template installation on Windows XP, I used Inno Setup. I haven't tried it on Windows 7, so I don't know whether the higher security would pose an issue.
Another alternative for using simple documents as templates (as long as, per jscher's comment, the forms don't need to make use of any features that require templates such as autotext or macros), is to distribute the 'documents as templates' via e-mail, and instruct the users to save them to a designated folder they can create, such as "My Documents/Form Templates".
They can then create new documents from the 'templates' (without ever opening the documents themselves) by using File > New > New From Existing > and then navigating to the location of the document to copy.
The following puts a template in the Word Startup folder to load it as an Add-In
Code:
Sub SaveToStartUpPath()
' Macro written by Charles Kyle Kenyon
' Saves template containing this macro to Word Startup Folder for use as a global template
'
'
On Error Resume Next
'
Dim Response As String, temp As String, x As VbMsgBoxResult
Selection.Collapse
If ActiveDocument.Type = wdTypeDocument Then
GoTo WhoopsDocument
Else
x = MsgBox("Click OK to continue saving " & ActiveDocument.Name & " to " & Application.StartupPath, vbInformation + vbOKCancel, _
"Ready to save template to your StartUpPath which is " & Application.StartupPath)
If x = vbCancel Then GoTo EndofSub
End If
If ActiveDocument.Type = wdTypeTemplate Then
ActiveDocument.SaveAs FileName:= _
Application.StartupPath & "\" & ActiveDocument.Name, _
FileFormat:=wdFormatTemplate, LockComments:=False, Password:="", _
AddToRecentFiles:=False, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
:=False, SaveAsAOCELetter:=False
End If
x = MsgBox(ActiveDocument.Name & " Add-In template saved. It will be active next time you start Word.", vbOKOnly & vbInformation, ActiveDocument.Name & " saved in " & Application.StartupPath)
GoTo EndofSub
WhoopsDocument:
x = MsgBox("Sorry, you need to be using the template. Please go back to the " & ActiveDocument.AttachedTemplate.Name & " template and Open it, then try this again!", vbExclamation, _
"Sorry!")
EndofSub:
On Error GoTo 0
End Sub
-----------------
The following will return the user templates folder path. You could store your template there using vba.
application.Options.DefaultFilePath(wdUserTemplate sPath)
On a side note (rant) if there are two things a Word user should get a handle on, they are Styles and Templates. Neither is all that hard and using them properly can make a person so much more productive! The basic idea of a template is that you can set something up the way you want and repeat it forever as needed. You don't have to worry about someone accidentally messing it up.
Protected forms can give you some of this functionality and while they don't have to be templates, that gives them one more layer of protection.
Last edited by Charles Kenyon; 2011-12-01 at 01:57.
Reason: Corrected code
The particular feature I believe we'd lose if we didn't use templates is the ability to save the fields only.
Gary, the approach you suggested is the one I'm using now, which my boss said is too complicated.
Charles, the macro is essentially the alternative solution I proposed. (I may not have made it clear that writing the macro is not an obstacle for me so much as having to use and maintain the macro is an obstacle for the organization.) Re your side note, I agree, but my objective is to encourage compliance with a procedure; forcing my users to learn new concepts in order to comply would defeat that goal, however good it would be for the users if they cooperated!
My boss decided that paper forms are perfectly OK for now, and considering the organization's present size, I think he's right. In that sense, the problem is solved. When we need to automate the forms, we'll just have to deal with one solution or the other.
This isn’t Word but it is certainly Office 2010 if you have the right version: Office InfoPath is an application that I think is dedicated to a wide variety of forms, and from the sound of your post, you would only require one copy of it. I have it in my version of Office, but I have never really studied nor used it, but it might fill the bill, and I suggest you learn what you can online (e.g. HERE) or from a textbook, and download a trial if possible. It’s so far off the map that I’ve never run across many discussions of it, so if it turns out to be of value I’m sure we’d be interested to hear of it.