Greetings, Wish to call a Visual Basic Script from a stored process. The code was developed and tested successfully on Base SAS. The script will execute when manually submitted as well. The script does not execute when called from a stored process. *ProcessBody; data _null_; call symput('user',translate("&_username",'_','.')); run; ods tagsets.excelxp file="C:\temp\temp.xml" ; proc print data=sashelp.class; run; ods tagsets.excelxp close; options xsync ; data _null_; file "C:\temp\temp.vbs"; put " Dim oXL "; put " Dim FSO"; put " Set oXL = CreateObject(""Excel.Application"")"; put " Set FSO = CreateObject(""Scripting.FileSystemObject"")"; put " oXL.DisplayAlerts = False"; put " oXL.Workbooks.Open(""C:\temp\temp.xml"")"; put " oXL.Visible = false"; put " if (oXL.Version) >= 12 Then" ; put " oXL.ActiveWorkBook.SaveAs Left(""C:\temp\temp.xml"", Len(""C:\temp\temp.xml"") - 4) & "".xlsx"",51"; put " Else"; put " oXL.ActiveWorkBook.SaveAs Left(""C:\temp\temp.xml"", Len(""C:\temp\temp.xml"") - 4) & "".xls"",-4143"; put " End If"; put " oXL.ActiveWorkBook.Close SaveChanges = True"; put " FSO.DeleteFile(""C:\temp\temp.xml""), DeleteReadOnly"; put " oXL.DisplayAlerts = True"; put " oXL.Quit"; put " Set oXL = Nothing"; run; X "cscript C:\temp\temp.vbs"; I did test the X and echo commands using the following. 45 +x "echo hello > %sysfunc(pathname(work))\hello.dat" 45 !+ ; 46 + 47 +data _null_; 48 + 49 + infile "%sysfunc(pathname(work))\hello.dat"; 50 + 51 + input; list; 52 + 53 +run; NOTE: The infile "T:\sastemp\_TD7088_DBPDEV_\Prc3\hello.dat" is: Filename=T:\sastemp\_TD7088_DBPDEV_\Prc3\hello.dat, RECFM=V,LRECL=256,File Size (bytes)=8, Last Modified=05Sep2012:14:21:16, Create Time=05Sep2012:14:21:16 RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 1 hello 6 NOTE: 1 record was read from the infile "T:\sastemp\_TD7088_DBPDEV_\Prc3\hello.dat". Thanks, F
... View more