471,342 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,342 software developers and data experts.

Silent SaveAs when using the Excel win32com module

I'm trying to create an excel file which will act as a log, however I
want to overwrite the file if it exists.

Looking at the SaveAs method I can't find anything that would allow
it. I don't want the prompt to appear to ask whether to replace the
file or not. I just want to replace it without thinking.

Thanks in advance.

Sep 10 '07 #1
3 6899
On Sep 10, 11:57 am, Chris <chris.ole...@gmail.comwrote:
I'm trying to create an excel file which will act as a log, however I
want to overwrite the file if it exists.

Looking at the SaveAs method I can't find anything that would allow
it. I don't want the prompt to appear to ask whether to replace the
file or not. I just want to replace it without thinking.

Thanks in advance.
Googling around I found that a way around this is to just delete the
file before you save (if it exists)... any other solutions?

Sep 10 '07 #2
Chris wrote:
I'm trying to create an excel file which will act as a log, however I
want to overwrite the file if it exists.

Looking at the SaveAs method I can't find anything that would allow
it. I don't want the prompt to appear to ask whether to replace the
file or not. I just want to replace it without thinking.
xl.DisplayAlerts = 0

where xl is the Application object.

TJG
Sep 10 '07 #3
On Sep 10, 5:24 pm, "Hamilton, William " <wham...@entergy.comwrote:
From: Chris
I'm trying to create an excel file which will act as a log, however I
want to overwrite the file if it exists.
Looking at the SaveAs method I can't find anything that would allow
it. I don't want the prompt to appear to ask whether to replace the
file or not. I just want to replace it without thinking.
Thanks in advance.

Check if the file exists and delete it before saving the new one.
It's more Pythonic to delete the file and catch the exception if it
doesn't actually exist.

Sep 10 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by TOM | last post: by
4 posts views Thread by Lance Hoffmeyer | last post: by
12 posts views Thread by vithi | last post: by
2 posts views Thread by Lance Hoffmeyer | last post: by
3 posts views Thread by =?Utf-8?B?Um9k?= | last post: by
4 posts views Thread by jld730 | last post: by
11 posts views Thread by Bill Davy | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.