[Tutor] Invoking Excel Macro
Alan Gauld
alan.gauld at freenet.co.uk
Fri Apr 21 12:35:09 CEST 2006
Hi arun,
Although you are invoking this from Python it is really more
of a COM/Excel issue. I think you might have more success
asking on an Excel forum. The Pythonwin community might
be able to help too, buit it looks to me like the problem is
in the macro itself. It seems to have dependencies on its
runtime environment being set up in a particular way.
Sorry I can't be more help,
Alan G
----- Original Message -----
From: "arun" <r.arunchand at gmail.com>
To: <tutor at python.org>
Sent: Friday, April 21, 2006 8:29 AM
Subject: [Tutor] Invoking Excel Macro
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
More information about the Tutor
mailing list