![]() |
GetSaveAsFilename Question
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 |
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 |
All times are GMT +1. The time now is 06:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com