[python-win32] Python and excel

2008-01-20 Thread Nicholas
Progressing through (lower regions of) the python/Com learning curve I cannot help but think (and I know im not the first to suggest this) that a python interpreter could take the place of the VBA editor. 1. It seems to me we could automatically set a com wrapper around any arbitrary function defin

[python-win32] Python and Excel

2008-01-10 Thread Jd H
Hi there, I have the below python code that was working via Windows Task Scheduler on Windows 2000 Terminal Server: import os, commands from win32com.client import Dispatch myExcel.Workbooks.Add('C:/JD/billing/Billing-Report-' + str(today) + '.xls') myExcel.Workbooks.Add('C:/JD/billing/macro.XLA

Re: [python-win32] Python and Excel via Cron

2007-11-21 Thread Jd H
I included an additional backslash and still same error type below: Traceback (most recent call last): File "c:\Python24\test.py", line 4, in ? myExcel.Workbooks.Add('C:\\Python24\\test.xls') File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 496, in __getattr__ rais

Re: [python-win32] Python and Excel via Cron

2007-11-21 Thread Larry Bates
Why are you using Cygwin cron instead of native Windows Task Scheduler (Windows version of cron-like scheduler)? These lines: > myExcel.Workbooks.Add('C:\Python24\\test.xls') > myExcel.Workbooks.Add('C:\Python24\\macro.XLA') > myExcel.ActiveWorkbook.SaveAs('C:\Python24\\test.xls') should re

Re: [python-win32] Python and Excel via Cron

2007-11-21 Thread Tim Roberts
Jd H wrote: > I am posting test.py again below: > > <<< > from win32com.client import Dispatch > > myExcel = Dispatch('Excel.Application') > myExcel.Workbooks.Add('C:\Python24\\test.xls') > myExcel.Workbooks.Add('C:\Python24\\macro.XLA') That's still not right. It will work this time, until s

Re: [python-win32] Python and Excel via Cron

2007-11-21 Thread Jd H
I am posting test.py again below: <<< from win32com.client import Dispatch myExcel = Dispatch('Excel.Application') myExcel.Workbooks.Add('C:\Python24\\test.xls') myExcel.Workbooks.Add('C:\Python24\\macro.XLA') myExcel.Run('Macro1') myExcel.Application.DisplayAlerts = False myExcel.Ac

Re: [python-win32] Python and Excel via Cron

2007-11-21 Thread John Machin
Jd H wrote: > 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 > What does "run from python" mean?? > > <<< > What's that "<<<"?? If you meant to

Re: [python-win32] Python and Excel via Cron

2007-11-21 Thread Tim Roberts
Jd H wrote: > 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') > myEx

Re: [python-win32] Python and Excel via Cron

2007-11-21 Thread bob gailer
Jd H wrote: > 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') > my

[python-win32] Python and Excel via Cron

2007-11-21 Thread Jd H
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