View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default GetSaveAsFilename Question

If the user enters a filename already in the directory, how can I
prevent the error 1004 message


The code prevent that ?

--
Regards Ron De Bruin
http://www.rondebruin.nl



"kev_06" wrote in message
...

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)


--
kev_06
------------------------------------------------------------------------
kev_06's Profile: http://www.excelforum.com/member.php...o&userid=35046
View this thread: http://www.excelforum.com/showthread...hreadid=548709