472,958 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 7593
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: TOM | last post by:
I want to saveas silently ! it will not prompt to user for saveas please tell me how can I do this silently. please do replay ! OLEObject IE IE = CREATE OLEObject
4
by: Lance Hoffmeyer | last post by:
Hey all, Having problems centering a column Can someone explain how to center a column using python? import win32com.client import re import codecs
12
by: vithi | last post by:
Hi Any one tell me where I can get (or download) python modules win32com or win32com.client because I have to use "Dispatch" thanks
10
by: Hendri Adriaens | last post by:
Hi, I'm trying to automate the creation of an excel file via COM. I copied my code below. I read many articles about how to release the COM objects that I create. The code below runs just fine...
1
by: Girish | last post by:
Hi, I want to embed a txt document into an excel using python. Here is my code, but i get an error message =================================================== Traceback (most recent call...
2
by: Lance Hoffmeyer | last post by:
Hey all, As always, thanks in advance! I am trying to save a ppt presentation but am having problems regarding spaces and am wondering if I am doing something wrong or whether this is a bug?...
3
by: =?Utf-8?B?Um9k?= | last post by:
The applicacion sends me the next message "Method not found: Excel._Worksheet.SaveAs (..." I thinks that its about permissions but I do not know how to fix it. I have the same source in two...
4
by: jld730 | last post by:
Greetings! A user will supply a .xls or .csv file (with location/directory) as a system argument. If it is a CSV file, the script moves on. If it is a XLS/XLSX file, the script should save it as...
11
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.