K
kev_06
Using the following code:
Sub Test()
Dim fname As Variant
Dim Wb As Workbook
Set Wb = ActiveWorkbook
Again:
fname = Application.GetSaveAsFilename("", _
fileFilter:="Excel Files (*.xls), *.xls")
'On Error Resume Next
If fname = False Then Exit Sub
If Dir(fname) <> "" Then GoTo Again
Wb.SaveAs fname
End Sub
If the user enters a filename already in the directory, how can I
prevent the error 1004 message? (If the user does not want to overwrite
the file and selects 'no', the error 1004 message appears)
Sub Test()
Dim fname As Variant
Dim Wb As Workbook
Set Wb = ActiveWorkbook
Again:
fname = Application.GetSaveAsFilename("", _
fileFilter:="Excel Files (*.xls), *.xls")
'On Error Resume Next
If fname = False Then Exit Sub
If Dir(fname) <> "" Then GoTo Again
Wb.SaveAs fname
End Sub
If the user enters a filename already in the directory, how can I
prevent the error 1004 message? (If the user does not want to overwrite
the file and selects 'no', the error 1004 message appears)