delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/16/14:03:17

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=1.0 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_64,J_CHICKENPOX_74,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <49E772BE.3020408@gmail.com>
Date: Thu, 16 Apr 2009 19:02:38 +0100
From: Derek Wallace <del DOT wallace AT gmail DOT com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.8.1.19) Gecko/20081204 SeaMonkey/1.1.14
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Problems running a vbscript from cron
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hi All,
I have written a simple vbscript. Its purpose is to convert an excel 
.xls file to .csv.
The script runs fine under Cygwin.
 > cscript xls2csv.vbs myexcel.xls myexcel.xls

I am trying to get the script to be run every night by setting up a cron 
job. I have the cron service running and ive added a mycron.bash file to 
my crontab file.
Cron is running fine and it is running mycron .bash file. The .bash file 
runs the vbscript as follows
cscript xls2csv.vbs myexcel.xls myexcel.xls

The problem i have is that the vbscript gives an error stating i dont 
have permissions to open the excel application.
Microsoft /VBScript/ runtime error: /Permission denied

/If i run the my .bash file from a Cygwin BASH shell it runs fine.

Any suggestions on how to go about debugging this?

Im running on Windows NT. Windows shell 5.6.

Thanks
Derek

This is the xls2csv.vbs. It falls over on line 5
Dim ArgObj
Set ArgObj = WScript.Arguments
xlsPath = ArgObj(0)
csvPath = ArgObj(1)
Set objExcel = CreateObject("Excel.Application")
objExcel.DisplayAlerts = 0
set workbook = objExcel.workbooks.open(xlsPath)
const xlCSV = 6
dim sheet
for each sheet in workbook.worksheets
   sheet.activate
   workbook.saveAs csvPath, xlCSV
next
objExcel.Quit
WScript.quit


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019