Saving filename in document properties

L

Leslie Pollak

Hi,
Using Word 2003
I have a word template (.dopt) that our business uses.
I would like to know if it possible to save the filename to the properties,
but only the 1st time the file is saved (.doc).
Our users are suppose to start a new document based on the template (.dot)
each time, but we are finding that many of them copy an existing document
(.doc) and make changes to it and then save it under the new filename (.doc).
I want to catch the instances of copying documents (.doc) by capturing the
initial filename (.doc) when the document is 1st saved from the template
(.dot). Then if someone opens the document (.doc) and saves it under a new
filename (.doc) or copies and renames the file (.doc).

Is this possible?
 
D

Doug Robbins - Word MVP

Maybe the following would serve your purpose:

Sub FileSaveAs()
Dim filename As String
On Error Resume Next
With ActiveDocument
filename = .Variables("varFileName").Value
If Err.Number = 5825 Then
Dialogs(wdDialogFileSaveAs).Show
.Variables("varFileName").Value = .Name
Else
MsgBox "Naughty, Naughty! You did not start this document from the
template."
End If
End With
End Sub

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

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