We need to run some Excel programs via cron and are using vbscript to do this.  
We have this running on a WinXP machine but are having trouble running on a 
Win7 machine, but we don't think it is a Win7 problem. 

Here's the script to run a simple test excel program: 

Dim xlApp 
Dim xlWb 
Set xlApp = CreateObject("Excel.application") 
xlApp.Visible = True 
Set xlWb = xlApp.workbooks.Open("c:\Shared\Prospect\Bin\TestExcel.xls") 
xlApp.Quit 
Set xlWb = Nothing 
Set xlApp = Nothing 

Here's how we run this test script from a terminal command prompt: 

c:/Windows/System32/wscript.exe 'c:\cygwin64\home\<cygwinLogin>\tst.vbs' 

This runs fine from a command line prompt but hangs when run as a cron job.  We 
have trapped the error message we get when the workbooks.Open is executed and 
get this: 

Microsoft Office Excel cannot access the file 
'c:\Shared\Prospect\Bin\TestExcel.xls'. There are several possible reasons: 

▒ The file name or path does not exist. 
▒ The file is being used by another program. 
▒ The workbook you are trying to save has the same name as a currently open 
workbook. 

We don't believe any of these possible reasons apply.  In particular, since it 
looked like this could be a permission issue, we changed the vbscript to simply 
copy the TestExcel.xls file and that works fine:

dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("c:\Shared\Prospect\Bin\TestExcel.xls") Then
        filesys.CopyFile "c:\Shared\Prospect\Bin\TestExcel.xls", 
"c:\cygwin64\home\<cygwinLogin>\"
Else
        WScript.Echo "file does not exist"
End If

This hanging also happens if we create a new spreadsheet and try to save it 
(and this works fine from a command line prompt).  So we can run excel programs 
from a cron job as long as we don't open an excel program or save a 
spreadsheet, which means it is useless. 

We also have a couple of other Win7 PCs.  This problem happens on 2 of the 3 
Win7 PCs but works on one of the Win7 PCs.  All 3 PCs are running Excel 2007 
SP3.  Two of these 3 PCs have the exact same version of Excel 2007 and one 
works and the other doesn't.

Anybody have any idea what could be going on here?  We only have this cron job 
problem when running an excel program via vbscript.  We haven't had any cron 
job problems with other non-excel scripts. 

Denis

--
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