; ; Script generated by AutoBuilder 0.5 Prototype ; Embedded Excel Object in AutoIt ; Helps you using Excelfunction and use the results of these back in AutoIT vars. ; Also this can be used as a replacement for the ListView, and load the data direct in the Excel Grid. ; PTREX 09/11/05 ; #include #NoTrayIcon ;Vars Dim $oMyError Dim $i Dim $j ; Initialize SvenP 's error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ;Declare objects $oExcel = ObjCreate("OWC10.spreadsheet") ; Default to Office XP If not IsObj($oExcel) Then $oExcel = ObjCreate("OWC11.spreadsheet") ; Office 2003 EndIf IF not IsObj($oExcel) Then $oExcel = ObjCreate("OWC9.spreadsheet") ; Office 2000 EndIf If IsObj($oExcel) Then with $oExcel ;.Worksheets ("Sheet1").Activate ;.activesheet.range ("A1:B10").value = "TEST INFO" for $i = 1 to 15 for $j = 1 to 15 .cells($i,$j).value = $i next next EndWith Else MsgBox(0,"Reply","Not an Object",4) EndIf ;Main Gui GuiCreate("Excel Object", 802, 590,(@DesktopWidth-802)/2, (@DesktopHeight-590)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $GUI_ActiveX = GUICtrlCreateObj ($oExcel, 10, 10 , 780 , 550) GUICtrlSetStyle ( $GUI_ActiveX, $WS_VISIBLE ) GUICtrlSetResizing ($GUI_ActiveX,$GUI_DOCKAUTO) ; Auto Resize Object GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd $oExcel = "" Exit ;This is Sven P's custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc