Hello everyone,
I am new with all macros and I`m trying to create macro which saves copy of workbook. But I cannot get my head going how to create one bit.. how to check the location before saving and if file name already exist message will come "file already exist please check name field" and would like to know instead of error message it will save file with add on like ...1.xls or ...copy1.xls, copy2.xls etc
this is code I`m using at the moment
Sub SaveAsB()
Dim FName As String
Dim FPath As String
FPath = '"C:\Test"
FName = Sheets("Sheet1").Range("A1").Text & Range("A2").Text
ActiveWorkbook.SaveCopyAs Filename:=FPath & "" & FName & ".xls"
End Sub
thanks
I am new with all macros and I`m trying to create macro which saves copy of workbook. But I cannot get my head going how to create one bit.. how to check the location before saving and if file name already exist message will come "file already exist please check name field" and would like to know instead of error message it will save file with add on like ...1.xls or ...copy1.xls, copy2.xls etc
this is code I`m using at the moment
Sub SaveAsB()
Dim FName As String
Dim FPath As String
FPath = '"C:\Test"
FName = Sheets("Sheet1").Range("A1").Text & Range("A2").Text
ActiveWorkbook.SaveCopyAs Filename:=FPath & "" & FName & ".xls"
End Sub
thanks