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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It's likely to have something to do with cygwin and using the cron
scheduling utility. The VBScript part (saved as a .vbs file) works fine on this Win7 Pro machine and so precludes this isn't where the problem lies. I suspect the Filename string gets modified somehow by the cron utility such that Excel can't interpret it correctly. FWIW: Note that my default Excel version is 2010 on this machine, but I can change that to whatever version you have for testing version-specific issues if you state what version you're working with. -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thursday, June 11, 2015 at 11:14:28 AM UTC-5, GS wrote:
It's likely to have something to do with cygwin and using the cron scheduling utility. The VBScript part (saved as a .vbs file) works fine on this Win7 Pro machine and so precludes this isn't where the problem lies. I suspect the Filename string gets modified somehow by the cron utility such that Excel can't interpret it correctly. FWIW: Note that my default Excel version is 2010 on this machine, but I can change that to whatever version you have for testing version-specific issues if you state what version you're working with. Here are the Excel versions we are using on these 3 Win7 PCs: Microsoft Office Excel 2007 (12.0.6718.5000) SP3 MSO (12.0.6607.1000) Microsoft Office Excel 2007 (12.0.6718.5000) SP3 MSO (12.0.6721.5000) Microsoft Office Excel 2007 (12.0.6718.5000) SP3 MSO (12.0.6721.5000) The first 2 versions are on the 2 Win7 PCs that fail and the last version is on the Win7 PC that succeeds. Since the 2nd and 3rd versions are identical, that would seem to rule out this being an Excel problem since one succeeds and the other fails. Here is the vbscript that was created to just copy the file that excel fails to open. This was done in an attempt to see whether there was a permission issue when run from the cron. If cron was mangling the filename, it seems like it would mangled it both for excel and for copying. dim filesys set filesys=CreateObject("Scripting.FileSystemObject") If filesys.FileExists("c:\Shared\Prospect\Bin\TestExc el.xls") Then filesys.CopyFile "c:\Shared\Prospect\Bin\TestExcel.xls", "c:\cygwin64\home\<cygwinLogin\" Else WScript.Echo "file does not exist" End If I wonder if the credentials/permissions inherited by excel from cron could be wrong. Is there any way to check these credentials? That would seem to be the one difference between excel opening this TestExcel.xls file versus just copying it. Starting up Excel is creating a separate process. Denis |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thursday, June 11, 2015 at 11:14:28 AM UTC-5, GS wrote:
It's likely to have something to do with cygwin and using the cron scheduling utility. The VBScript part (saved as a .vbs file) works fine on this Win7 Pro machine and so precludes this isn't where the problem lies. I suspect the Filename string gets modified somehow by the cron utility such that Excel can't interpret it correctly. FWIW: Note that my default Excel version is 2010 on this machine, but I can change that to whatever version you have for testing version-specific issues if you state what version you're working with. Here are the Excel versions we are using on these 3 Win7 PCs: Microsoft Office Excel 2007 (12.0.6718.5000) SP3 MSO (12.0.6607.1000) Microsoft Office Excel 2007 (12.0.6718.5000) SP3 MSO (12.0.6721.5000) Microsoft Office Excel 2007 (12.0.6718.5000) SP3 MSO (12.0.6721.5000) The first 2 versions are on the 2 Win7 PCs that fail and the last version is on the Win7 PC that succeeds. Since the 2nd and 3rd versions are identical, that would seem to rule out this being an Excel problem since one succeeds and the other fails. Here is the vbscript that was created to just copy the file that excel fails to open. This was done in an attempt to see whether there was a permission issue when run from the cron. If cron was mangling the filename, it seems like it would mangled it both for excel and for copying. dim filesys set filesys=CreateObject("Scripting.FileSystemObject") If filesys.FileExists("c:\Shared\Prospect\Bin\TestExc el.xls") Then filesys.CopyFile "c:\Shared\Prospect\Bin\TestExcel.xls", "c:\cygwin64\home\<cygwinLogin\" Else WScript.Echo "file does not exist" End If I wonder if the credentials/permissions inherited by excel from cron could be wrong. Is there any way to check these credentials? That would seem to be the one difference between excel opening this TestExcel.xls file versus just copying it. Starting up Excel is creating a separate process. Denis Excel doesn't inherent credentials/permissions! These are file system properties. On the errant machine there must be some anomoly causing its Excel install to behave this way. I'd be inclined to run 'Repair' in Control Panel Programs and Features before going any further. Also, try this VBScript and see what happens... Dim xlApp Dim xlWb Set xlApp = CreateObject("Excel.application") xlApp.Visible = True Set xlWb = xlApp.workbooks.Open("C:\Shared\Prospect\Bin\TestE xcel.xls") Set xlWb = Nothing Set xlApp = Nothing ...and if it works then the problem lies with either cron's processing on that system -OR- that system's handling of the cron process. -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thursday, June 11, 2015 at 9:11:52 PM UTC-5, GS wrote:
Excel doesn't inherent credentials/permissions! These are file system properties. On the errant machine there must be some anomoly causing its Excel install to behave this way. I'd be inclined to run 'Repair' in Control Panel Programs and Features before going any further. Also, try this VBScript and see what happens... Dim xlApp Dim xlWb Set xlApp = CreateObject("Excel.application") xlApp.Visible = True Set xlWb = xlApp.workbooks.Open("C:\Shared\Prospect\Bin\TestE xcel.xls") Set xlWb = Nothing Set xlApp = Nothing ..and if it works then the problem lies with either cron's processing on that system -OR- that system's handling of the cron process. Changing the filename on the workbooks.Open as suggested above didn't make any difference. I looked for the repair option under Control Panel/Program Features but didn't find one. However, I can't imagine this is the issue. On the other Win7 PC that also has this problem I had re-installed Excel a while back and that didn't make any difference. This version of Excel was the same version as the one on the Win7 PC that does work. Denis |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thursday, June 11, 2015 at 9:11:52 PM UTC-5, GS wrote:
Excel doesn't inherent credentials/permissions! These are file system properties. On the errant machine there must be some anomoly causing its Excel install to behave this way. I'd be inclined to run 'Repair' in Control Panel Programs and Features before going any further. Also, try this VBScript and see what happens... Dim xlApp Dim xlWb Set xlApp = CreateObject("Excel.application") xlApp.Visible = True Set xlWb = xlApp.workbooks.Open("C:\Shared\Prospect\Bin\TestE xcel.xls") Set xlWb = Nothing Set xlApp = Nothing ..and if it works then the problem lies with either cron's processing on that system -OR- that system's handling of the cron process. Changing the filename on the workbooks.Open as suggested above didn't make any difference. I copy/pasted the filename from your original post. Don't know what you mean by "changing the filename"! Are you saying the VBScript didn't work with your correct file string? I looked for the repair option under Control Panel/Program Features but didn't find one. However, I can't imagine this is the issue. On the other Win7 PC that also has this problem I had re-installed Excel a while back and that didn't make any difference. This version of Excel was the same version as the one on the Win7 PC that does work. Denis -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
Reply |
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 |