Can REV create Excel files?

Martin Blackman martinblackman at gmail.com
Fri Mar 16 21:17:31 EDT 2007


Just continuing down the path which Ken helped put me on, I thought
I'd share my little routine which uses vbscript to get the Names in an
Excel workbook and the ranges to which they refer:

function getXLNames
   put "Dim ObjXL,tRetVal,tName" & cr & \
         "Set ObjXL = GetObject(," & q("Excel.Application") & ")" into tScript
   put cr& "For Each tName In ObjXL.ActiveWorkbook.Names" & cr & \
         "tRetVal = tRetVal & tName.Name  & tName.RefersTo & vbCrLf" &
cr & "Next" after tScript
   put cr & "tRetVal = Left(tRetVal,Len(tRetVal) - 2)" & cr & \
         "WScript.Echo tRetVal" after tScript
   put tmpfolder&"/VBSTemp.vbs" into tFile  --tmpfolder is a global
var holding a path
   put tScript into url("file:" & tFile)
   set the hideconsolewindows to true
   get shell("cscript.exe //nologo" && tFile)
   send "delete file" && q(tFile) to me in 1 second
   if char -1 of it is cr then delete char -1 of it
   return it
end getXLNames



More information about the use-livecode mailing list