Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with getsaveasfilename Jo Excel Discussion (Misc queries) 2 June 5th 07 12:41 AM
a question about "Application.GetSaveAsFileName" 12Keys Excel Programming 2 April 13th 06 06:25 AM
Help with GetSaveAsFilename aj Excel Programming 0 March 23rd 06 08:32 PM
GetSaveAsFileName Greg Hadrych Excel Programming 1 July 29th 04 12:52 AM
After GetSaveAsFileName question Stuart[_5_] Excel Programming 1 July 9th 04 09:29 PM


All times are GMT +1. The time now is 09:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"