PDA

View Full Version : Template Location



markh1182
11-06-2007, 04:29 AM
Hi, This is really a general question to get peoples ideas/thoughts.

At the moment we store templates on the C drive of each users machines. Obviously rolling out updates to these templates isn't as quick and easy as I like, and rolling back after an update is even harder.

Does anyone store templates on a networked drive and all users get the templates from there? Is there any problems with doing it this way?

Thanks, Mark

Belch
11-06-2007, 11:03 AM
Mark,
We store lots of templates on the network (for faxes, letters, etc) which people use every day without problems.

If your VBA refers to a location on the C drive it would probably need changing to the location on the network (depends on what the VBA does of course).

If there is only one central copy of the template an update to that will be reflected in any new documents created using it.

Nelviticus
11-07-2007, 08:51 AM
We do the same - all templates on a network drive. So that laptop users always have the latest version we run a "copy if newer" script to copy files from the network share to the C: drive, but I don't like that idea because if you remove or rename some templates everyone still has a copy of the old ones.

If you ever end up re-naming or moving the network share, any existing documents that are linked to templates at the old location will cause Word to hunt for the old templates every time they're opened. For this reason, all our templates have code to detach the documents from the templates once they're created.

Regards

fumei
11-07-2007, 01:52 PM
Network drives are fine for templates.

However, as Nelviticus points out, there can be an issue if the network location is changed. I would like to see your code to detach, if that is possible. Can you post that?

Nelviticus
11-08-2007, 02:02 AM
Sure, we put this in a module called AutoNew:
Attribute VB_Name = "AutoNew"
Option Explicit

Public Sub Main()

' Detaches new document from its template

On Error GoTo Err_AutoNew

With ActiveDocument

.UpdateStylesOnOpen = False
.AttachedTemplate = ""

End With

Exit_AutoNew:

Exit Sub

Err_AutoNew:

With Err

MsgBox "Error number " & .Number & vbCr & _
"in function AutoNew" & vbCr & .Description

End With

Resume Exit_AutoNew

End Sub

That's the code for templates without any forms or other code. If they have forms they're usually launched before the 'With' block.

Really it just boils down to having 'ActiveDocument.AttachedTemplate = ""' in an AutoNew function.

Regards

TonyJollans
11-08-2007, 03:50 AM
There should be no problem with network locations for templates and having all users looking at a "Workgroup Templates" location would be far easier to manage.

Nelveticus's idea of disconnecting the network template after use is also good if it is no longer needed and/or the documents may be distributed to users who don't have access to the network drive.