Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Addin using SaveAs Function

Hello,

I'm having an interesting yet seemingly easy to fix problem in an
Excel Addin that I have been developing. Within the Addin, I save the
current file as a temp file, and then I save it back to it's original
path. I also do the same thing in Microsoft Word. In Excel, I am asked
if I would like to overwrite the original file, whereas in Micrsoft
Word, the save takes place without any dialogs. I tried setting the
AlertBeforeOverwriting property of the excelApplication to false, but
it has no effect. Any ideas on this problem would be greatly
appreciated.

Thank You,
Rob Heinen

Here is the code:

excelApplication.AlertBeforeOverwriting = false;

excelApplication.ActiveWorkbook.SaveAs( tempPath, extension,
missing, missing, missing, missing,
XlSaveAsAccessMode.xlShared,
missing, missing, missing, missing, missing );

//resave as the original
excelApplication.ActiveWorkbook.SaveAs( origPath, extension,
missing, missing, missing, missing,
Microsoft.Office.Interop.Excel.XlSaveAsAccessMode. xlShared, missing,
missing, missing, missing, missing );

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Excel Addin using SaveAs Function

In VBA you can suppress this with

Application.DisplayAlerts = False
' do the save
application.displayAlerts = True

this is not a persistent setting, so it isn't a parameter you can set
outside of using code.

I am not sure it will work form .NET, so you might just need to delete the
file before doing the save.

--
Regards,
Tom Ogilvy


" wrote:

Hello,

I'm having an interesting yet seemingly easy to fix problem in an
Excel Addin that I have been developing. Within the Addin, I save the
current file as a temp file, and then I save it back to it's original
path. I also do the same thing in Microsoft Word. In Excel, I am asked
if I would like to overwrite the original file, whereas in Micrsoft
Word, the save takes place without any dialogs. I tried setting the
AlertBeforeOverwriting property of the excelApplication to false, but
it has no effect. Any ideas on this problem would be greatly
appreciated.

Thank You,
Rob Heinen

Here is the code:

excelApplication.AlertBeforeOverwriting = false;

excelApplication.ActiveWorkbook.SaveAs( tempPath, extension,
missing, missing, missing, missing,
XlSaveAsAccessMode.xlShared,
missing, missing, missing, missing, missing );

//resave as the original
excelApplication.ActiveWorkbook.SaveAs( origPath, extension,
missing, missing, missing, missing,
Microsoft.Office.Interop.Excel.XlSaveAsAccessMode. xlShared, missing,
missing, missing, missing, missing );


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Addin using SaveAs Function

Thanks Tom,

That solved it. The DisplayAlerts property works in .NET also,
apparently. Thanks again.

-Rob


Tom Ogilvy wrote:
In VBA you can suppress this with

Application.DisplayAlerts = False
' do the save
application.displayAlerts = True

this is not a persistent setting, so it isn't a parameter you can set
outside of using code.

I am not sure it will work form .NET, so you might just need to delete the
file before doing the save.

--
Regards,
Tom Ogilvy



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
Excel Addin Function gives #NAME? Errors Maurice Elliott Excel Programming 5 December 9th 05 10:24 PM
Difficulty in SaveAs an Addin Huyeote[_11_] Excel Programming 4 October 4th 05 03:00 AM
saveas addin from VBA Dave Ring Excel Programming 3 July 18th 04 12:45 PM
excel show #NAME? when use a addin function Ronald Dodge Excel Programming 0 September 8th 03 06:22 PM
overwrite Excel SaveAs function from File menu susie Excel Programming 1 July 31st 03 04:47 AM


All times are GMT +1. The time now is 08:24 PM.

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"