Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Help with ActiveWorkbook.SaveAs

Hello,

The line below saves the current workbook, but errors if I have an existing
workbook with the same name already. Is there an additional parameter that
will overwrite the existing workbook with this new one? If not, how should I
go about overwriting the existing workbook? I could put some code in to
check if the workbook name already exist and name the new workbook
appropriately, but I wanted to see if there was something simpler. Thanks.

objExcel.ActiveWorkbook.SaveAs strOutputFilePath

--
Regards,
Martin X.
MCSA: M


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 301
Default Help with ActiveWorkbook.SaveAs

Precede the statement with
Application.DisplayAlerts = False

"Martin X." wrote in message
...
Hello,

The line below saves the current workbook, but errors if I have an
existing
workbook with the same name already. Is there an additional parameter that
will overwrite the existing workbook with this new one? If not, how should
I
go about overwriting the existing workbook? I could put some code in to
check if the workbook name already exist and name the new workbook
appropriately, but I wanted to see if there was something simpler. Thanks.

objExcel.ActiveWorkbook.SaveAs strOutputFilePath

--
Regards,
Martin X.
MCSA: M




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Help with ActiveWorkbook.SaveAs

Try following:

Application.DisplayAlerts = False

Regards
reklamo


"Martin X." wrote:

Hello,

The line below saves the current workbook, but errors if I have an existing
workbook with the same name already. Is there an additional parameter that
will overwrite the existing workbook with this new one? If not, how should I
go about overwriting the existing workbook? I could put some code in to
check if the workbook name already exist and name the new workbook
appropriately, but I wanted to see if there was something simpler. Thanks.

objExcel.ActiveWorkbook.SaveAs strOutputFilePath

--
Regards,
Martin X.
MCSA: M



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help with ActiveWorkbook.SaveAs

Try something like:

On Error Resume Next
Kill strOutputFilePath
On Error Goto 0
objExcel.ActiveWorkbook.SaveAs strOutputFilePath

This will delete the file named by strOutputFilePath if it exists and then
does the SaveAs. Note that Kill permanently deletes the file. It does not
send it to the Windows Recycle Bin. If you want to Recycle the file, see
http://www.cpearson.com/excel/recycle.htm .


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)




"Martin X." wrote in message
...
Hello,

The line below saves the current workbook, but errors if I have an
existing
workbook with the same name already. Is there an additional parameter that
will overwrite the existing workbook with this new one? If not, how should
I
go about overwriting the existing workbook? I could put some code in to
check if the workbook name already exist and name the new workbook
appropriately, but I wanted to see if there was something simpler. Thanks.

objExcel.ActiveWorkbook.SaveAs strOutputFilePath

--
Regards,
Martin X.
MCSA: M



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
ActiveWorkbook.SaveAs franks Excel Programming 6 August 6th 07 10:04 PM
Set mySavedSummary = ActiveWorkbook.SaveAs( ....... WhytheQ Excel Programming 2 March 29th 07 05:43 AM
'ActiveWorkbook.SaveAs Filename' TOMB Excel Programming 2 February 15th 05 11:51 PM
ActiveWorkbook.SaveAs Problem SowBelly Excel Programming 4 August 4th 04 10:58 PM
activeworkbook.saveas J Silver Excel Programming 0 June 25th 04 09:01 PM


All times are GMT +1. The time now is 05:43 AM.

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

About Us

"It's about Microsoft Excel"