97-2003-2007 change .dot or .dotx extension macro

F

Fred

How do I update the macro from MVP site to include 2007 .dotx extension or
allow it to select the default .doc or .dotx extension. OR can the extension
be dropped and default to 97-2003 or 2007 depending on which program is
open - many thanks.

Sub SaveIncrementedFilename()

Dim PathAndFileName As String, n As Long

PathAndFileName = "c:\test\test"
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
 
P

Perry

You could test the version number of Word of
VBA 2K7 (version 12.0) and change the extensions accordingly

? application.Version
12.0

Krgrds,
Perry
 

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