1、呼叫excel物件開啟工作表;Dim oe As New Excel.ApplicationDim ow As WorkbookDim os As WorksheetSet ow = oe.Workbooks.AddSet os = ow.Worksheets(1)oe.Visible = True2、取消excel窗體的標題欄、選單欄、工具欄;For Each bar In Application.CommandBarsIf Not bar.BuiltIn And Not bar.Visible Then bar.DeleteNextApplication.CommandBars("Worksheet Menu Bar").Position = msoBarFloatingApplication.CommandBars("Worksheet Menu Bar").Left = -Application.CommandBars("Worksheet Menu Bar").Width + 1Application.CommandBars("Worksheet Menu Bar").Top = -Application.CommandBars("Worksheet Menu Bar").Height + 13、將excel窗體設定為某窗體的"子窗體",調整大小並放在合適位置Dim IStyle As LongIStyle = GetWindowLong(hwnd, GWL_STYLE)IStyle = IStyle And Not WS_CAPTION And Not WS_EX_APPWINDOWSetWindowLong hwnd, GWL_STYLE, IStyleShowWindow hwnd, SW_SHOWDrawMenuBar hwndSetParent hwnd, Form1.hwnd
1、呼叫excel物件開啟工作表;Dim oe As New Excel.ApplicationDim ow As WorkbookDim os As WorksheetSet ow = oe.Workbooks.AddSet os = ow.Worksheets(1)oe.Visible = True2、取消excel窗體的標題欄、選單欄、工具欄;For Each bar In Application.CommandBarsIf Not bar.BuiltIn And Not bar.Visible Then bar.DeleteNextApplication.CommandBars("Worksheet Menu Bar").Position = msoBarFloatingApplication.CommandBars("Worksheet Menu Bar").Left = -Application.CommandBars("Worksheet Menu Bar").Width + 1Application.CommandBars("Worksheet Menu Bar").Top = -Application.CommandBars("Worksheet Menu Bar").Height + 13、將excel窗體設定為某窗體的"子窗體",調整大小並放在合適位置Dim IStyle As LongIStyle = GetWindowLong(hwnd, GWL_STYLE)IStyle = IStyle And Not WS_CAPTION And Not WS_EX_APPWINDOWSetWindowLong hwnd, GWL_STYLE, IStyleShowWindow hwnd, SW_SHOWDrawMenuBar hwndSetParent hwnd, Form1.hwnd