#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Save

Hi Everybody,
I'm programming Excel in Outlook and export some data from Outlook to Excel,
I want to save newly added data in Excel and I use the following code
appExcel.Activeworkbook.Save
but I get the following message
A file named "xyz.xls" already exists in this clocation . Do you wnat to
replace it?
how can I avoid this message?

by the way I use the following code as well
Set appExcel=Createobject("Excel.application")
appExcel.workbooks.open(" filepath ")


--
Best regards,
Edward
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Save

before the save:

appExcel.DisplayAlerts=False
--
Gary''s Student - gsnu200844


"Edward" wrote:

Hi Everybody,
I'm programming Excel in Outlook and export some data from Outlook to Excel,
I want to save newly added data in Excel and I use the following code
appExcel.Activeworkbook.Save
but I get the following message
A file named "xyz.xls" already exists in this clocation . Do you wnat to
replace it?
how can I avoid this message?

by the way I use the following code as well
Set appExcel=Createobject("Excel.application")
appExcel.workbooks.open(" filepath ")


--
Best regards,
Edward

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Save

There are (at least) two ways to do this:

On Error Resume Next
Kill "xyz.xls"
appExcel.ActiveWorkbook.Save

' Or

Application.DisplayAlerts = False
appExcel.ActiveWorkbook.Save
Application.DisplayAlerts = True

If the file already exists, you might want to consider sending to the
Recycle Bin rather than killing it. See
www.cpearson.com/Excel/Recycle.aspx for info about sending a file to
the recycle bin.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Wed, 8 Apr 2009 15:11:01 -0700, Edward
wrote:

Hi Everybody,
I'm programming Excel in Outlook and export some data from Outlook to Excel,
I want to save newly added data in Excel and I use the following code
appExcel.Activeworkbook.Save
but I get the following message
A file named "xyz.xls" already exists in this clocation . Do you wnat to
replace it?
how can I avoid this message?

by the way I use the following code as well
Set appExcel=Createobject("Excel.application")
appExcel.workbooks.open(" filepath ")

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
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
Command Button Save As Application.ExecuteExcel4Macro ("SAVE.AS?() Paul Dennis Excel Discussion (Misc queries) 5 September 18th 06 05:34 PM
Disable save, save as, but allow save via command button TimN Excel Programming 10 September 1st 06 07:05 PM
How to diasble save and save as menu but allow a save button hon123456 Excel Programming 1 June 12th 06 09:50 AM
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: harpscardiff[_10_] Excel Programming 8 November 10th 05 12:24 PM


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