Rename word document

A

arjun dutta

i have a file called "abc1.doc".. can u suggest something
that whenever i edit the file, it will automatically be
renamed as "abc2.doc" . whenever i edit +1 will be added
automatically.
eg: "abc3.doc" then "abc4.doc" etc..

i hope u understand my question.
KINDLY PLEASE REPLY TO MY EMAIL ADDRESS ALSO..
thank you
My email: (e-mail address removed)
 
G

Graham Mayor

I use something similar which could be set up as an autoopen macro, though I
prefer to run it manually from a toolbar button. It is based on Doug
Robbin's web page - http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm which
will provide the background. You will need to set the path and the original
filename. Use a unique file - here c:\settings.txt - to hold the count.

Sub SaveNumberedVersion()
'Based on code by Doug Robbins
Dim strPath, strFile As String

strPath = "D:\My Documents\Test\" 'set path
strFile = "My File " 'set filename

Order = System.PrivateProfileString("C:\Settings.Txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order

ActiveDocument.SaveAs FileName:=strPath & strFile & _
Format(Order, "00#")
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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