Save file

D

Daren White

I have a template which has a sendforreview button attached. I need to save
the document before I can use the sendforreview command. Is there any way I
can use the saveas command and have it saved as doc1 then doc 2 the next time
it is used then doc3 and so on?
 
H

Helmut Weber

Hi Daren,

something along these lines:

Sub MyFileSaveAs()
Dim sNam As String
Dim lTmp As Long
sNam = ActiveDocument.FullName
sNam = Left(sNam, Len(sNam) - 4) ' not Word 2007
If Not IsNumeric(Right(sNam, 3)) Then
sNam = sNam & "-000" & ".doc"
ActiveDocument.SaveAs sNam
Else
lTmp = CLng(Right(sNam, 3))
lTmp = lTmp + 1
sNam = Left(sNam, Len(sNam) - 4)
sNam = sNam & Format(lTmp, "-000")
sNam = sNam & ".doc"
ActiveDocument.SaveAs sNam
End If

End Sub

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

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