Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
We are using cygwin (which provides Unix-like functionality on Windows) so that we can not only use Unix-like tools but also use the cron scheduling facility. We need to run some Excel programs 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\TestE xcel.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. This hanging also happens if we create a new spreadsheet and try to save it (and this works fine from a command 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. 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Set a reference to Microsoft VBScript Regular Expressions(vbscript.dll) | Excel Programming | |||
Run VBScript from Excel | Excel Discussion (Misc queries) | |||
vbscript and Excel | Excel Programming | |||
Excel & VBScript | Excel Programming | |||
Using excel through vbscript | Excel Programming |