Hi
I have a word document where on the On Close event I have the following code:
But it only works once and not everytime the document is closed. I would it like it work everytime the doc is closed is this possible?
I have a bookmark that inserts a piece of test when ithe doc is opened is there a way for me to use that text as the file name when it is saved?
Thanks for any help
I have a word document where on the On Close event I have the following code:
Code:
Sub SaveFilename()
Dim PathAndFileName As String, n As Long
PathAndFileName = Path & "\Letters\.doc"
If Dir(PathAndFileName & ".doc") = "" Then
ActiveDocument.SaveAs (PathAndFileName & ".doc")
Else
n = 1
Do While Dir(PathAndFileName & n & ".doc") <> ""
n = n + 1
Loop
ActiveDocument.SaveAs PathAndFileName & n & ".doc"
End If
End Sub
But it only works once and not everytime the document is closed. I would it like it work everytime the doc is closed is this possible?
I have a bookmark that inserts a piece of test when ithe doc is opened is there a way for me to use that text as the file name when it is saved?
Thanks for any help