syberschmo Posted June 21, 2006 Share Posted June 21, 2006 (edited) Hi! Is it possible to embed a COM object on a tab sheet with GuiCtrlCreateObject()? The Excel object that I am trying to embed is misbehaving, but before I post any code, I wanted to make sure that Autoit3 beta 126 supports this functionality. I cannot find any reference in the helpfile. EDIT: No replies... guess I'll post some code! The COM object is created, but it appears on the first tab instead of the second tab when the GUI is first loaded. Also, there are a lot of problems sending input to the sheet. Pressing enter after entering data makes the sheet (but not the toolbar) flicker and disappear. Here's the code. expandcollapse popup#include <GUIConstants.au3> #Include <GuiTab.au3> $window_title = "Tools" $frm_main = GUICreate($window_title, 627, 317, -1, -1, BitOr($GUI_SS_DEFAULT_GUI, $WS_SYSMENU, $WS_VISIBLE, $WS_CLIPSIBLINGS, $WS_OVERLAPPEDWINDOW)) $Tab1 = GUICtrlCreateTab(0, 4, 625, 273) $TabSheet1 = GUICtrlCreateTabItem("First") $ednums = GUICtrlCreateEdit("", 8, 33, 121, 240, BitOr($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_MULTILINE, $WS_TABSTOP, $ES_NUMBER), $WS_EX_CLIENTEDGE) $TabSheet2 = GUICtrlCreateTabItem("Second") _GUICtrlCreateListViewEnhanced("Col1|Col2|Col3", 3, 33, 250, 235) $TabSheet3 = GUICtrlCreateTabItem("Third") ;another excel com object? _GUICtrlTabSetMinTabWidth($Tab1, 100) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Tab1 If GuiCtrlRead($Tab1) = 0 Then ;TAB1 DYNAMIC FUNCTIONS Elseif GuiCtrlRead($Tab1) = 1 Then ;TAB2 DYNAMIC FUNCTIONS Elseif GuiCtrlRead($Tab1) = 2 Then ;TAB3 DYNAMIC FUNCTIONS EndIf EndSelect WEnd Exit ;GuiCtrlCreateListViewEnhanced (Taken from Ptrex's SQLite3 GUI) Func _GUICtrlCreateListViewEnhanced($col_names,$left,$top,$width,$height) ;Create Spreadsheet object. if RegRead("HKCR\OWC9.spreadsheet","") then $ExcelLV = ObjCreate("OWC9.spreadsheet") if RegRead("HKCR\OWC10.spreadsheet","") then $ExcelLV = ObjCreate("OWC10.spreadsheet") if RegRead("HKCR\OWC11.spreadsheet","") then $ExcelLV = ObjCreate("OWC11.spreadsheet") If IsObj($ExcelLV) Then with $ExcelLV .AllowPropertyToolbox = True .DisplayOfficeLogo = false .DisplayPropertyToolbox = False .DisplayTitleBar = False .DisplayToolbar = False ;.ViewOnlyMode = True ;.autofit = True ;.Maxwidth = 1000 ;.Maxheight = 1000 EndWith With $ExcelLV.ActiveWindow .DisplayGridlines = True .DisplayHorizontalScrollBar = True .DisplayVerticalScrollBar = True .DisplayColumnHeadings = True .DisplayRowHeadings = True .DisplayWorkbookTabs = False .EnableResize = false EndWith $owcWbook = $ExcelLV.ActiveWorkbook $owcWSheet=$owcWbook.ActiveSheet $GUI_ActiveX = GUICtrlCreateObj($ExcelLV,$left,$top,$width,$height) guictrlsetstyle(-1,$ws_visible) GUICtrlSetResizing($GUI_ActiveX,$gui_dockAuto) ;$ExcelLV.activesheet.rows(2).Select ;$ExcelLV.Activewindow.FreezePanes = True $owcWSheet.cells(1,1).Select MouseClick("Left") $TempHeadingArray = stringsplit($col_names,"|") with $ExcelLV for $i = 1 to $tempheadingarray[0] ;.cells(1,$i).value = $tempheadingarray[1] .activewindow.columnheadings($i).caption = $Tempheadingarray[$i] .columns($i).autofit next EndWith Else MsgBox(0,"Reply","You don't appear to have the office web components installed. If you are using Office 2000, the components do not support spreadsheets. Sorry.",4) EndIf EndFunc Thanks in advance for looking. Edited June 21, 2006 by syberschmo Gradient-Filled Progress Bars UDF Link to comment Share on other sites More sharing options...
syberschmo Posted June 23, 2006 Author Share Posted June 23, 2006 Bump. I posted some code. The main alternative (Editable listview) is undergoing some revision at the moment. Is an Excel com object possible? By the way, I have office 10. Gradient-Filled Progress Bars UDF Link to comment Share on other sites More sharing options...
syberschmo Posted June 26, 2006 Author Share Posted June 26, 2006 Bump. Have subsequently confirmed the error with both Office 10 and 11 Excel objects. I'm guessing COM-object tab functionality is not possible?? Please, someone knowledgeable post a boolean response to verify my assumption. Gradient-Filled Progress Bars UDF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now