Can REV create Excel files?
Ken Ray
kray at sonsothunder.com
Sun Mar 18 20:51:30 EDT 2007
On Sat, 17 Mar 2007 10:17:31 +0900, Martin Blackman wrote:
> 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
Very nice, Martin! Looks good to me...
:-)
Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode
mailing list