Advertisement
overloop

ExcelWorkbooks.au3

Dec 21st, 2015
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.57 KB | None | 0 0
  1. Func ExcelWorkbooks()
  2.   ; Error handler, automatic cleanup at end of function
  3.   Local $oError = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc")
  4.   #forceref $oError
  5.   Local $oWorkbook, $iCount = 0, $sCLSID_Workbook = "{00020819-0000-0000-C000-000000000046}" ; Microsoft.Office.Interop.Excel.WorkbookClass
  6.   Dim $sBooks[100]
  7.   While True
  8.     $oWorkbook = ObjGet("", $sCLSID_Workbook, $iCount + 1)
  9.     If @error Then
  10.        ReDim $sBooks[$iCount]
  11.        Return $sBooks
  12.       EndIf
  13.     $sBooks[$iCount] = $oWorkbook.FullName
  14.     $iCount += 1
  15.   WEnd
  16. EndFunc   ;==>ExcelWorkbooks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement