[Tutor] Invoking Excel Macro

Mike Hansen mhansen at cso.atmel.com
Fri Apr 21 18:38:12 CEST 2006


In the macro, you might try Application.DisplayAlerts = False  and reset it
to True after you save.
I think it might be trying to display a dialog box before it saves. 
 
Mike


  _____  

From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
Of arun
Sent: Friday, April 21, 2006 1:44 AM
To: tutor at python.org
Subject: Re: [Tutor] Invoking Excel Macro


I'm sorry , there is something realy wrong with 'Run-time error 1004':. I
have fixed it now but still it throws an error while trying to save the
workbook.


On 4/21/06, arun <r.arunchand at gmail.com> wrote: 

Hi, 
I tried invoking a macro from my python script and  It is  throwing  an
error message that reads 'Run-time error 1004':
 
"This operation requires the merged cells to be identically sized"
 
My script looks like this 
 
from win32com.client import Dispatch
xl = Dispatch('Excel.Application')
xl.Workbooks.Add('E:\Templates\sample.xls')
xl.Run('Import_file')  # name of the macro
 
Also while (running the macro)opening the workbook it  names it as
"sample1.xls' ,and so 
It says there is no such file sample.xls
 
"
Filename =  Myexcel.xls
Workbooks("sample.xls").SaveAs Filename
"
 
Can somebody help me with this issue : (
 
 
Thanx

arun 
 
 


 




-- 
arun 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060421/c9fe0c58/attachment.htm 


More information about the Tutor mailing list