Hi,

Following is the scenario:

I have a document named: CCPC_01.doc
The user opens up the document makes the changes.

I want a macro which would save the updated version of this document
(doesnt matter if its in the same folder) with the following name:
CCPC_01_locked.doc

All Help is Appreciated

Re: Saving document with new name via vba by rachitm

rachitm
Tue Jun 26 16:33:39 CDT 2007

To restate what I would like help with is that I want a macro which
will add "_locked".doc at the end of the current name of the document
and save it as a new file.

Thanks


Re: Saving document with new name via vba by Tony

Tony
Tue Jun 26 22:57:14 CDT 2007

On Jun 27, 7:33 am, rach...@gmail.com wrote:
> To restate what I would like help with is that I want a macro which
> will add "_locked".doc at the end of the current name of the document
> and save it as a new file.
>
> Thanks

Hi Rach,

Try this.
Dim strNewName As String
Dim dt As Single 'Location of the dot before the filename
extension

strNewName = ActiveDocument.FullName
dt = InStrRev(strNewName, ".")
strNewName = Left(strNewName, dt - 1) & "_Locked" &
Mid(strNewName, dt)
ActiveDocument.SaveAs FileName:=strNewName

This will keep save the document to the same folder and preserve the
extension.
Of course this new doc now becomes the activedociument so if you then
want to go back/work on the original document you have to close this
new one and open the original.

Cheers
TonyS.