Embedded principle is to set up the dialog is set to the parent window:
M_excelHwnd=: : FindWindow (NULL, m_exlApp get_Caption ());
: : SetParent (m_excelHwnd, this - & gt; M_hWnd);
At first the machine test can run normally, Excel menu bar; Run found menu bar to disappear for a period of time, more change to test the other machines also found Excel menu bar disappears, Excel version is 2007, consult how to solve the strange phenomenon of Excel menu bar disappear,
CodePudding user response:
All showCommandBars collection objects
Please refer to the event attribute methods
CommandBars (CommandBar)
CommandBarControls (CommandBarControl)
CommandBarButton
CommandBarComboBox
CommandBarPopup
A representative container in the application toolbar CommandBar object collection,
Using CommandBars collection
With CommandBars property can be returned CommandBars set, the following example in the Immediate window display each menu bar and toolbar and local name, the name of and display a numerical value to indicate whether the bar menu or toolbar appears on the screen,
For Each cbar CommandBars in
Debug. Print cbar. Name, cbar. NameLocal cbar. Visible,
Next
Use the Add method can Add a new command in the collection, the following example creates a custom toolbar "Custom1" as a floating toolbar, according to
The Set cbar1=CommandBars. Add (Name:="Custom1", the Position:=msoBarFloating)
Cbar1. Visible=True
With CommandBars (index) can return a CommandBar object; Here the name of the command bar, or index is the index number, the following example will toolbar "Custom1" fixed at the bottom of the application window,
CommandBars (" Custom1 "). The Position=msoBarBottom
Note available name or index number specified in the container the application's menu bar and toolbar in the list of the menu bar or the toolbar, but can only use the name of the specified menu, context menu or sub menu (all these contents can be represented by CommandBar object),
If two or more than two custom menu or sub menu with the same name, then CommandBars (index) to return to the first menu with this name, in order to ensure the return the correct menu or submenu, shows the pop-up menu controls can be found then the popup control using CommandBar attribute to return on behalf of the menu command bar,
CodePudding user response:
CommandBars attributePlease refer to the application in the sample feature
Return CommandBars object, the object represents Microsoft Excel command bar, read-only,
Description
Together with the Application object is used, this property returns all effective for the Application of built-in and custom command bar,
If work thin embedded in another application and the user double click to activate the work sheet, using this attribute and the Workbook object can return to the Microsoft Excel all effective command bar set in the application, any other time together with the Workbook object using this property returns Nothing,
No programming method can be used to return to a command bar attached to work thin,
Example
This example to delete all custom command bar is not visible,
For Each bar In Application.Com mandBars
If Not bar. The BuiltIn And Not bar. The Visible Then bar. Delete
Next
CodePudding user response:
Add his new discovery: the embedded Excel after get focus, if press Ctrl + F2, there will be a print preview screen, then press ESC to exit, the menu bar,CodePudding user response:
Sub aaa ()
Aa, bb, Dim As Boolean
Aa=True
Bb=False
Application.Com mandBars (" the ply ".) Enabled=aa
'click the worksheet TAB is available
Application.Com mandBars (" cell ".) Enabled=aa
'click the cell is available
Application.Com mandBars (" toolbar list ") Enabled=aa
'click toolbars and "view" - "toolbar" is available
Application.Com mandBars (" autocalculate ".) Enabled=aa
'click the status bar is available
Application.Com mandBars (" worksheet menu bar ".) Enabled=aa
Application.Com mandBars (1) Enabled=aa
'the role of the above two sentences are the menu to cancel
Application.Com mandBars (2) Enabled=aa
'temporarily unknown
Application.Com mandBars (3) Enabled=aa
'common toolbar is available
'Application.Com mandBars (3) Controls, (3) Enabled=aa
'the third "save" in the common toolbar is available
Application.Com mandBars (4) Enabled=aa
'the format toolbar is available
Application.Com mandBars (5) Enabled=aa
'temporarily unknown
Application.Com mandBars (1) Enabled=aa
'restore menu available
Application.Com mandBars (1). Controls (1) Enabled=aa
'to make the "file" menu is available
'Application.Com mandBars (" file "). Controls (" page setup (& amp; U)... ") Enabled=aa
'menu of "file" in the "page setup" are available
Application.Com mandBars (1.) Controls, (4) Enabled=aa
'menu of the fourth "insert" is available
Application.Com mandBars (1.) Controls, (4). The Caption="victor"
'
name changeApplication.Com mandBars (1). Reset
'the recovery menu
Application. DisplayFormulaBar=aa
'edit bar is displayed
Application. DisplayStatusBar=aa
'whether the status bar displays
ActiveWindow. DisplayHeadings=aa
'row number column whether displays
ActiveWindow. DisplayWorkbookTabs=aa
Whether a 'worksheet TAB displays
ActiveWindow. DisplayHorizontalScrollBar=aa
'whether the horizontal scroll bar display
ActiveWindow. DisplayVerticalScrollBar=aa
'the vertical scroll bar is displayed
End Sub
From the Internet to find restore script, Alt + F11 callout paste after code execution still is invalid,
CodePudding user response:
The great spirit show ~ ~ ~ pleaseCodePudding user response:
After perform in an attempt to restore the script for the menu bar, simulated press F5 to refresh the current window?PostMessage (WND, WM_KEYDOWN, VK_F5, 0);
CodePudding user response: