-
1
- #1
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[blue]Option Explicit
Public Sub MakeOldMenus()
Dim OldMenu As CommandBar
Dim OldMenu2 As CommandBar
Dim lp As Long
' Delete our current custom menus, if they exist
KillMenus
' Create an old-style toolbar
' Set the last argument to False for a (slightly) more compact menu
Set OldMenu = Application.CommandBars.Add("Old Menus", , True)
Set OldMenu2 = Application.CommandBars.Add("Old Menus2", , False)
' Now copy the controls from Excel's "Built-in Menus" shortcut menu
' using IDs to avoid language issues
With Application.CommandBars("Built-in Menus")
.FindControl(, 30002).Copy OldMenu
.FindControl(, 30003).Copy OldMenu
.FindControl(, 30004).Copy OldMenu
.FindControl(, 30005).Copy OldMenu
.FindControl(, 30006).Copy OldMenu
.FindControl(, 30007).Copy OldMenu
'.FindControl(, 30008).Copy OldMenu 'Does not exist in Excel
.FindControl(, 30011).Copy OldMenu
.FindControl(, 30009).Copy OldMenu
.FindControl(, 30010).Copy OldMenu
End With
' For additional fun, add Standard and Formatting toolbars below menu
' Unfortunately we cannot display them in the ribbon in quite the same way as we might want
For lp = 1 To Application.CommandBars("Standard").Controls.Count
Application.CommandBars("Standard").Controls.Item(lp).Copy OldMenu2
Next
For lp = 1 To Application.CommandBars("Formatting").Controls.Count
Application.CommandBars("Formatting").Controls.Item(lp).Copy OldMenu2
Next
' Make menu and tollbars visible. They appears in the Add-Ins tab
Application.CommandBars("Old Menus").Visible = True
Application.CommandBars("Old Menus2").Visible = True
End Sub[/blue]
[blue]Public Sub KillMenus()
' Delete our current custom menus, if they exist
On Error Resume Next
Application.CommandBars("Old Menus").Delete
Application.CommandBars("Old Menus2").Delete
On Error GoTo 0
End Sub[/blue]
[blue]Public Sub MakeOldMenus()
Dim OldMenu As CommandBar
Dim OldMenu2 As CommandBar
Dim lp As Long
' Delete our current custom menus, if they exist
KillMenus
' Create an old-style toolbar
' Set the last argument to False for a (slightly) more compact menu
Set OldMenu = Application.CommandBars.Add("Old Menus", , True)
Set OldMenu2 = Application.CommandBars.Add("Old Menus2", , False)
' Now copy the old style menu items onto our custom menu
' using IDs to avoid language issues
On Error Resume Next
With Application.CommandBars
.FindControl(, 30002).Copy OldMenu
.FindControl(, 30003).Copy OldMenu
.FindControl(, 30004).Copy OldMenu
.FindControl(, 30005).Copy OldMenu
.FindControl(, 30006).Copy OldMenu
.FindControl(, 30007).Copy OldMenu
.FindControl(, 30008).Copy OldMenu ' Does not exist in Excel - error handling will skip it
.FindControl(, 30011).Copy OldMenu ' Does not exist in Word - error handling will skip it
.FindControl(, 30009).Copy OldMenu
.FindControl(, 30010).Copy OldMenu
End With
On Error GoTo 0
' For additional fun, add Standard and Formatting toolbars below menu
' Unfortunately we cannot display them in the ribbon in quite the same way as we might want
For lp = 1 To Application.CommandBars("Standard").Controls.Count
Application.CommandBars("Standard").Controls.Item(lp).Copy OldMenu2
Next
For lp = 1 To Application.CommandBars("Formatting").Controls.Count
Application.CommandBars("Formatting").Controls.Item(lp).Copy OldMenu2
Next
' Make menu and tollbars visible. They appears in the Add-Ins tab
Application.CommandBars("Old Menus").Visible = True
Application.CommandBars("Old Menus2").Visible = True
End Sub[/blue]