GetSaveAsFilename Question

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)
 

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