Windows Python People,

 

It was suggested that I might find more help with this question here
than on the tutor list.

 

I am running an excel macro from python with the following code:

 

The problem I'm having is that when I try to run this function I get a
dialog window that pops up titled: "Update Values: Personal.xls" When I
try to cancel out of it I get directed to a type mismatch in the excel
macro.

 

The program is very long so I won't paste the whole thing here, just the
call to the excel macro. What seems key is that the macro runs fine in
excel. And I've run excel macros from python before. The only difference
is that now the macro also calls some excel user defined functions.
Since they live in Personal.xls I'm thinking that is the wrinkle here.
All of my searching has led me nowhere. Has no one ever had this issue?

 

You'll note the excessive closing language in the function. I thought
that maybe what was happening is that more than one instance of excel
was open and that was causing a problem with accessing personal.xls, as
will happen if you try to manually open more than one instance of excel
in windows.

 

def runExcelMacro():

    excel = win32.Dispatch("Excel.Application")

    excel.Visible = 0

    fTest =
excel.Workbooks.Add("D:\\Data\\Excel\\Blank_Summary_Report_Template_Macr
o_20111114.xls")

    macName = "macroAllFiles"

    macName = fTest.Name + '!' + macName

    print macName

    excel.Run(macName)

    excel.DisplayAlerts = 0

    fTest.Close(1)

    excel.Quit()

    del excel

 

Any ideas!? Let me know if you need more info.

 

Thanks

Matt

 

Matthew Pirritano, Ph.D.

Research Analyst IV

Medical Services Initiative (MSI)

Orange County Health Care Agency

(714) 568-5648

 

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to