Hi Experts,
I’ve been trying to resolve this issue for the past week and it is proving difficult.
I have a simple vb script that converts all .xls files to .csv in specified location (i.e. c:\temp). When I double click the .vbs file, it works beautifully. However when I try to run this from Data Services using exec command. It behaves really strange.
Firstly the .vbs file contains:
WorkingDir = "C:\Temp"
Extension = ".XLS"
Dim fso, myFolder, fileColl, aFile, FileName, SaveName
Dim objExcel,objWorkbook
Set fso = CreateObject("Scripting.FilesystemObject")
Set myFolder = fso.GetFolder(WorkingDir)
Set fileColl = myFolder.Files
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
objExcel.DisplayAlerts= False
For Each aFile In fileColl
ext = Right(aFile.Name,4)
If UCase(ext) = UCase(extension) Then
'open excel
FileName = Left(aFile,InStrRev(aFile,"."))
Set objWorkbook = objExcel.Workbooks.Open(aFile)
SaveName = FileName & "csv"
objWorkbook.SaveAs SaveName, 23
objWorkbook.Close
End If
Next
Set objWorkbook = Nothing
Set objExcel = Nothing
Set fso = Nothing
Set myFolder = Nothing
Set fileColl = Nothing
I’ve tried using these commands in Data Services
exec('cscript','c:\\temp\\test.vbs',0);
exec('wscript','c:\\temp\\test.vbs',0);
I even tried creating a .bat file which calls this .vbs file.
Everything I do, it did’nt work and errors I receive were different depending on what I used.
If I use ‘cscript’ it gives me the following error:
5608 5488 PRINTFN 30/05/2012 2:04:44 PM c:\temp\convert_REF.vbs(21, 3) Microsoft Excel: Microsoft Excel cannot access the file 'C:\Temp\test.XLS'. There are several
5608 5488 PRINTFN 30/05/2012 2:04:44 PM possible reasons: The file name or path does not exist. The file is being used by another program. The workbook you
5608 5488 PRINTFN 30/05/2012 2:04:44 PM are trying to save has the same name as a currently open workbook.
If I use ‘wscript’ the job runs and doesn’t do anything until I kill it manually.
I initially thought that this is a security previledge issue but I can see that all Data Services account has full previledges. Let alone the file location is in the ETL box itself!
I ran out of all options. I think I’ve tried everything I can ever think of.
Could you please help.
Thanks alot
Jamesy121 (BOB member since 2009-05-04)