LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Unable to run excel via vbscript

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set a reference to Microsoft VBScript Regular Expressions(vbscript.dll) cate Excel Programming 2 December 1st 09 03:07 PM
Run VBScript from Excel Amy M Excel Discussion (Misc queries) 4 September 19th 08 09:07 PM
vbscript and Excel HSalim[MVP] Excel Programming 8 April 12th 07 08:02 PM
Excel & VBScript Bill Ebbing Excel Programming 7 September 8th 05 06:27 PM
Using excel through vbscript ashtom1 Excel Programming 6 July 6th 05 02:55 PM


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"