Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default SaveAs Confict Resolution Help ?

Greetings,
Using xl2007
Code:
NewWBName =
Application.GetSaveAsFilename(InitialFileName:="0-Job.xls", _
filefilter:=" Excel 2000-2003 Workbook (*.xls), *.xls,")
If NewWBName = False Then
Range("Date").Activate
Application.ScreenUpdating = True
Exit Sub
Else
NewWB_Setup 'Create a copy of "Report" and convert formulas to
values
' Save new file as 2000-2003 format from version 2007.
NewWB.SaveAs NewWBName, FileFormat:=56, CreateBackup:=False
End If

The above code works well except if the file name already exists and the
user selects 'No' or 'Cancel' from the Conflict Resolution Dialog box.
| A file named '...\0-Job.xls' already exists in this location. Do you want
to replace it?
| Yes / No / Cancel

How can I change my code to handle those selections?
Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default SaveAs Confict Resolution, Failure

Sorry, I neglected to state the failure.
The line - NewWB.SaveAs NewWBName, FileFormat:=56, CreateBackup:=False
causes Run-time error'1004': Method 'SaveAs' of object '_Workbook' failed

"Bassman62" wrote in message
...
Greetings,
Using xl2007
Code:
NewWBName =
Application.GetSaveAsFilename(InitialFileName:="0-Job.xls", _
filefilter:=" Excel 2000-2003 Workbook (*.xls), *.xls,")
If NewWBName = False Then
Range("Date").Activate
Application.ScreenUpdating = True
Exit Sub
Else
NewWB_Setup 'Create a copy of "Report" and convert formulas to
values
' Save new file as 2000-2003 format from version 2007.
NewWB.SaveAs NewWBName, FileFormat:=56, CreateBackup:=False
End If

The above code works well except if the file name already exists and the
user selects 'No' or 'Cancel' from the Conflict Resolution Dialog box.
| A file named '...\0-Job.xls' already exists in this location. Do you
want to replace it?
| Yes / No / Cancel

How can I change my code to handle those selections?
Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default SaveAs Confict Resolution Help ?

you could use
Application.DisplayAlerts = False

which completely avoids the issue -- unfortunatley is doesn't stop the user
saving over files accidentally

You could add a line that has checks if the file exists --- before the file
Save As line, and then handle the result

"Bassman62" wrote in message
...
Greetings,
Using xl2007
Code:
NewWBName =
Application.GetSaveAsFilename(InitialFileName:="0-Job.xls", _
filefilter:=" Excel 2000-2003 Workbook (*.xls), *.xls,")
If NewWBName = False Then
Range("Date").Activate
Application.ScreenUpdating = True
Exit Sub
Else
NewWB_Setup 'Create a copy of "Report" and convert formulas to
values
' Save new file as 2000-2003 format from version 2007.
NewWB.SaveAs NewWBName, FileFormat:=56, CreateBackup:=False
End If

The above code works well except if the file name already exists and the
user selects 'No' or 'Cancel' from the Conflict Resolution Dialog box.
| A file named '...\0-Job.xls' already exists in this location. Do you
want to replace it?
| Yes / No / Cancel

How can I change my code to handle those selections?
Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default SaveAs Confict Resolution Help ?

Thanks for the reply.
It worked to use the 'Dir' function to test for an existing filename and
then use Application.DisplayAlerts = False to avoid the alert.
Thanks again.


"Patrick Molloy" wrote in message
...
you could use
Application.DisplayAlerts = False

which completely avoids the issue -- unfortunatley is doesn't stop the
user saving over files accidentally

You could add a line that has checks if the file exists --- before the
file Save As line, and then handle the result

"Bassman62" wrote in message
...
Greetings,
Using xl2007
Code:
NewWBName =
Application.GetSaveAsFilename(InitialFileName:="0-Job.xls", _
filefilter:=" Excel 2000-2003 Workbook (*.xls), *.xls,")
If NewWBName = False Then
Range("Date").Activate
Application.ScreenUpdating = True
Exit Sub
Else
NewWB_Setup 'Create a copy of "Report" and convert formulas
to values
' Save new file as 2000-2003 format from version 2007.
NewWB.SaveAs NewWBName, FileFormat:=56, CreateBackup:=False
End If

The above code works well except if the file name already exists and the
user selects 'No' or 'Cancel' from the Conflict Resolution Dialog box.
| A file named '...\0-Job.xls' already exists in this location. Do you
want to replace it?
| Yes / No / Cancel

How can I change my code to handle those selections?
Thanks.



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
saveas ActiveWorkbook.SaveAs Filename:=Range("A1").Value DarrenL Excel Programming 4 April 18th 09 07:54 AM
Screen Resolution Jason Zischke Excel Programming 1 February 20th 06 07:17 AM
Screen Resolution Jason Zischke Excel Programming 2 February 15th 06 05:36 AM
AddIn Name Resolution William Barnes[_2_] Excel Programming 5 October 29th 05 09:08 PM
Screen Resolution Ronbo Excel Programming 2 January 17th 05 08:45 PM


All times are GMT +1. The time now is 07:47 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"