SaveAS but DON'T Overwrite Code

KimMiller
06-19-2001, 08:44 AM
HELP! I am new to this...very new. Anyway. Below is a simple code for a SAVEAS macro. How
do I tell it NOT to overwrite existing files named the same?

Sub docsave()
var1 = "F:\PRIVATE\"
docsave1 = InputBox("Enter name of file", "SAO Word Processing", var1)
If docsave1 = "f:\private\\\" Then docsave1 = ""
If docsave1 > "" Then ActiveDocument.SaveAs docsave1
End Sub

Definition of Insanity: Doing the same thing, day-after-day, expecting different results.

Gazzo
06-20-2001, 05:49 AM
You could try using the Dir function.

Existing = Dir(docsave1)

If the file exists Dir returns the file name so you could then say

If Existing = "" Then ActiveDocument.SaveAs docsave1

Hope this helps.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum