![]() |
|
#2
|
||||
|
||||
|
Try:
Code:
Sub ReSave()
Dim StrName As String, StrExt As String, StrNum As String, Rslt
With ActiveDocument
StrName = .Name
StrExt = Right(StrName, Len(StrName) - InStrRev(StrName, ".") + 1)
StrName = Left(StrName, InStrRev(StrName, ".") - 1)
StrNum = Format(Split(StrName, " ")(UBound(Split(StrName, " "))) + 1, "00")
StrName = Left(StrName, InStrRev(StrName, " "))
StrName = .Path & "\" & StrName & StrNum & StrExt
If Dir(StrName) <> "" Then
Beep
Rslt = MsgBox("The new filename:" & vbCr & StrName & vbCr & "already exists." & _
vbCr & "Continue saving (overwrite existing file)?", vbOKCancel)
If Rslt = vbCancel Then Exit Sub
End If
.SaveAs2 FileName:=StrName, FileFormat:=.SaveFormat
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] Last edited by macropod; 05-22-2013 at 11:06 PM. Reason: Added warning code |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can not save read only document | crescere | Word | 1 | 03-30-2013 11:19 PM |
| Word ask to save template whenever i save a derived document | jorbjo | Word | 3 | 10-04-2012 10:52 AM |
| Using Save As on a Read Only Document | jenc13 | PowerPoint | 1 | 01-18-2012 11:34 AM |
Cannot save Word document
|
don madsen | Word | 6 | 09-16-2011 09:02 PM |
code to save / rename / send attachments
|
unit213 | Outlook | 1 | 09-26-2007 08:15 PM |