I'm not sure but I think Larry was saying the issue was that Excel by its 
nature is an interactive program and that was the crux of the problem, even 
though I was running Excel without any interactive input.  (And Larry wanted to 
emphasize this wasn't a cygwin problem per se - it was a problem with getting 
cygwin/cron to function within the windows structure.)

However, sometimes you get lucky even though you don't quite know what you are 
doing.  Having given up on being able to run Excel from a cron I started 
investigating running a bash script via the windows task scheduler 
(http://www.davidjnice.com/cygwin_scheduled_tasks.html).  A colleague of mine 
had already set up some Excel programs running from the task scheduler and I 
checked them out and noticed he ran them via a vbscript by creating a shell to 
run the Excel programs.  A light bulb went off and, guessing that a shell is by 
definition able to handle an interactive program like Excel, I ran this 
vbscript from a cron job (run with c:/Windows/System32/wscript.exe):

Dim objShell
Set objShell = Wscript.CreateObject("WScript.Shell")
objShell.Run "C:\cygwin64\home\<login>\TestExcel.xls", 1, true
Set objShell = Nothing

This worked!  The cron ran the TestExcel.xls via WScript.Shell and this .xls 
saved itself (saveas) as a .htm file.  This demonstrated that an Excel program 
could be run and it could create a file.  This also worked with the cron set up 
to run either under cygserver or my cygwin login.

There was one wrinkle here.  The previous script that wouldn't run under Win7 
was set up to initiate the Excel program and then terminate it.  This shell 
approach initiated the Excel program but left the Excel program still running.  
I had to add an explicit 'Application.Quit' in my Excel macro to force the 
termination of Excel, a fairly minor change.

Thanks to all who helped me reach this solution.  Hopefully it may help others 
with a similar problem.

Denis

-------------------------------------------------------------------------------------------------------------------------
Andy Hall wrote:

I think Denis is saying Excel hangs even if it doesn't require user 
interaction. 
 I.e.  it runs some macros and exits.   On Win7 Pro, I was able to run the 
following 
.vbs script via the task scheduler and have it run the  "AddTimeInColumn" macro.
The resulting spreadsheet had the times the task was run column A.

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to