Hello,
   
  I have the below python code which opens an excel sheet, runs a macro then 
save the file. When run from python it runs perfectly. Code is below. File name 
is test.py
   
  <<< 
  from win32com.client import Dispatch
   
  myExcel = Dispatch('Excel.Application')
  myExcel.Visible = 1
  myExcel.Workbooks.Add('C:\Python24\test.xls')
  myExcel.Workbooks.Add('C:\Python24\macro.XLA')
  myExcel.Run('Macro1')
  myExcel.Application.DisplayAlerts = False
  myExcel.ActiveWorkbook.SaveAs('C:\Python24\test.xls')
  myExcel.Quit()
  >>> 
   
  When run from cron, it fails at line 3 when it opens the file with below 
message:
   
  Traceback (most recent call last):
    File "c:\Python24\test.py", line 20, in ?
      jd.Workbooks.Add('C:\Python24\test.xls')
    File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 496, 
in __getattr__
      raise AttributeError, "%s.%s" % (self._username_, attr)
  AttributeError: Excel.Application.Workbooks
   
  Any ideas how to resolve this?
   
  Thanks, JD

       
---------------------------------
Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to