VC implements dial-up network programs
In Office2000, in terms of user interface, Word is the first 56 toolbar, and 50 popup menu, but Excel (40 toolbar, 51 pop-up menus) And PowerPoint (43 toolbars, 25 pop-up menus) also have differentiated. Most users may have never seen all of these toolbars, and many users don't know that Office provides so much command tool. Although we can hide or display some toolbars with the [View / Toolbar] menu, this menu does not list all of the toolbars. For Word, you can see a few more toolbars from the [Tools / Custom] menu, but still less than 56. Similar to Excel and PowerPoint. So where did these lost toolbars? How can I see these toolbars? How to display these toolbars in the menu? First, the considerable part of the button on the toolbar off behind the toolbar is the so-called drop-down button. Click these drop-down buttons to display the submenu. One of the molecular menus is special, with a gray horizontal strip (Microsoft called "mobile handle"). For example, the [Font Color] button of the Word [Format] toolbar, click on its small arrow and move the mouse to the mobile handle, and the ash color is blue and prompt "dragging this menu". " Press and hold the mobile handle to drag the menu from the toolbar to float, as shown in Figure 1. Once the menu is dragging down into a floating toolbar, the toolbar is automatically listed under the [Toolbar] menu; if the toolbar is turned off, the name below the menu is not seen. Therefore, if you want to display this toolbar again or repeat the original drag process. Second, the macro display hidden toolbar can be dragged down the menu with the drawing or color function, and you are accessing from the [Drawing] toolbar. The following table gives the title and its names of some of the toolbars: Name Title Fill Color Fill Color Line Color Line Color Font Color Font Color Shading Color Bottom Color Border Border In the macro, you can access these menus, or use these menus Displayed as a floating toolbar. For example, to display the [Font Color] toolbar, you can use the following command: Commandbars ("font color"). Visible = true to raise an example. If you want to add color labels for Word documents, it is best to quickly access [Font Color], [Line Color], [Fill Color] and [Note] Four toolbar. I can write a subroutine:... Sub ShowCalloutToolbars (OnOrOff As Boolean) CommandBars ( "Callouts") Visible = OnOrOff CommandBars ( "Font Color") Visible = OnOrOff CommandBars ( "Line Color") Visible = OnOrOff CommandBars ( "Fill Color ") .Visible = Onoroff End Sub then displays and hides the above four toolbars with the following two commands: ShowCallOuttoolbars true showcallouttoolbars false, of course, with macro display or close some hidden toolbar, which is also very much in many other circumstances Help, these applications have to be found by the reader.
Third, listed in the menu As mentioned earlier, the [View / Toolbar] menu does not display the hidden toolbar, and there is no way to customize the menu to join the additional toolbar, but this is not to say that we can't Display these toolbars in the menu you created yourself. The method described next can be plus a [Hidden Toolbar] menu under the [View / Toolbar] menu. Figure 2 shows the [Hidden Toolbar] menu in Word, which is similar in other Office applications. First we need a macro Autoexec, which is automatically run when Word starts, calls AddhiddenToolbarsoption, and the latter adds the [Hidden Toolbar] menu in the [Toolbar] of the View menu. AutoExit runs when Word is closed, call RemoveHiddenToolbarsoption, and delete the [Hidden Toolbar] menu. Sub AutoExec () CustomizationContext = NormalTemplate AddHiddenToolBarsOption End Sub Sub AutoExit () CustomizationContext = NormalTemplate RemoveHiddenToolBarsOption End Sub Sub AddHiddenToolBarsOption () 'in the View menu' toolbar 'add the following' Hide Toolbar 'menu item RemoveHiddenToolBarsOption With CommandBars ( "View") With .controls.add (Type: = msocontrol pop-up, _ before: =. Controls ("Toolbar (& T)"). INDEX 1) .caption = "Hide Toolbar (& H)" .onAction = "ListhiddenToolbars" End with end with end sub subs removehiddenToolbarsoption () on error resume next commandbars ("View"). Controls ("Hide Toolbar (& H)"). Delete End Sub ListhiddenToolbars runs when the user clicks [hidden toolbar], Its task is to find out the submenu of the [Hidden Toolbar] with the toolbar not listed in the [View / Toolbar] menu.
Sub ListHiddenToolbars () Dim ExistingBars As String Dim TBar As CommandBar Dim Ctl As CommandBarControl Dim HiddenBarList As CommandBarControl Set HiddenBarList = CommandBars.ActionControl So, how does it know which of the toolbar to show or hide it? First, for the toolbar of [View / Tools], ListhiddenToolbars generates a title list with the following code: with commandbars ("View"). Controls ("Toolbar (& T)" for i = 1 TO. Controls.count - 1 EXISTINGBARS = Endingbars & _ .controls (i) .caption & vbcr Next End with 'Empty New Create Submenu for Each CTL in HiddenBarlist.Controls CTL.Delete Next In this For loop, program traversal [view / Toolbar】 Menu, saved all displayed toolbar titles in the existingbars variable, separated between VBCRs. (Can be separated by other characters, but use VBCR to be commissioned.) After the program can use existingbars to avoid the toolbar repeatedly displayed. Next, the following FOX loop: for each tbar in commandbars if tbar.builtin = true and _ TBAR.TYPE = msobartypenormal and tbar.enabled = true and _ TBAR.Visible = false and _ instr (existingbars, tbar.namelocal & VBCR) = 0 THEN WIDDENBARLIST.CONTROLS.ADD .CAPTION = Replace (TBAR.NAMELOCAL, "&", "&&") .Parameter = TBAR.NAME .onAction = "Displaytoolbar" End with end if next 'joins "self Definition 'Command With HiddenBarlist.controls.add (ID: = 797) .beggingRoup = True End with end Sub This FOR loop task is: Traversing the entire Commandbars collection, for each CommandBar: 1. Check if the buildin property is True, Exclude all custom toolbars. 2. Check if the Type property is MSObartypenormal (ie 0) to exclude the menu bar, the pop-up menu, make sure that only those "true" toolbars are displayed. 3. Enabled attribute values must also be True to ensure that only those available menus are displayed. For example, when the full-screen display mode is not in the full screen display, the toolbar should not be displayed. 4. Some toolbars, such as [Function Key Show], even if it is visible, its name is not displayed under the [View / Toolbar] menu, so you must also check if the visible property is false.