template attachement questions

K

keith brickey

Is it practical to attach a template that is located on a sharepoint web
site instead of on the local computer? Is there some way to prevent a
document from being updated if the template is not attached?

Thanks,

keith
 
P

Peter

Not knowing much about sharepoint websites, I can't comment on that question except to say that Word expects to find templates in either its defined folders (open Word, click Tools->Options...->File Locations tab) or in the same folder as the document. I suppose that if you can change one of the template locations in Word to point to the website (Seems like it would depend on the syntax. If you can use UNC notation, then it might work) then, sure, you could store the template there. Otherwise, perhaps a .vbs script that queries Word for the User Templates location, then downloads the template from the sharepoint website to that folder would be a good solution. You could run it on login, maybe. Hmm... that's alot of commenting for one who "can't comment on that question"... :)
As far protecting the document, sure, you can take some measures. Something like the following might work for you:

''' put in the template, in a sub that runs when a document based on the template is closed:

Dim ProtectType as Integer
Dim Password as String

ProtectType = wdAllowOnlyFormFields
If CLng(Val(Application.Version)) > 10 Then ProtectType = 3 ' O2k3 has a wdAllowOnlyReading protection type that's the preferred protection type
With ActiveDocument
On Error Resume Next
Password = .Variables("Password")
On Error GoTo 0
If Password = "" Then
Call Randomize
Password = CStr((9999 * Rnd) + 1000) ' get a reasonably random password
Call .Variables.Add("Password", Password)
End If
If .ProtectionType = wdNoProtection Then Call ..Protect(ProtectType, True, Password)
Call .Save
End With


''' put in the template, in a sub that runs when a document based on the template is opened

Dim Password as String

With ActiveDocument
On Error Resume Next
Password = .Variables("Password")
On Error GoTo 0
If .ProtectionType <> wdNoProtection Then Call .Unprotect(Password)
Call .Save
End With

The above code will lock and password-protect the document when it is closed, so that if it's then opened w/out the template, the user will have to unlock it in order to make changes, and will have to know/figure out the password in order to do so. the password is stored in a document variable so that when the document is opened with the template in place, the template will unlock it. I'm sure there are more secure ways to do this, but for the typical user, this will probably be sufficient.

hth,

-Peter
 

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

Top