M
moonhk
Hi All
I have Excel 2003 menu, In Excel 2007 can not able to user. Any
suggestion ?
Const XMENU = "PERSONAL"
Sub Auto_open()
'~~ VBA
Call PerActiveMenu
End Sub
Sub Auto_close()
Call PerDeleteMenu
End Sub
Sub PerDeleteMenu()
On Error Resume Next
CommandBars(1).Controls(XMENU).Delete
End Sub
Sub PerActiveMenu()
'~~ Sub menu
Dim HelpMenu As CommandBarControl
Dim NewMenu As CommandBarPopup
Dim MenuItem As CommandBarControl
Dim SubMenuItem As CommandBarControl
'~~ delete the menu if it already exists
Call PerDeleteMenu
'~~ find the help Menu
Set HelpMenu = CommandBars(1).FindControl(ID:=30010)
If HelpMenu Is Nothing Then
Set NewMenu = CommandBars(1).Controls _
.Add(Type:=msoControlPopup, temporary:=True)
Else
Set NewMenu = CommandBars(1).Controls _
.Add(Type:=msoControlPopup, before:=HelpMenu.Index, _
temporary:=True)
End If
'~~ Add a caption for the menu
NewMenu.Caption = XMENU
'~~ First Menu Item
Set MenuItem = NewMenu.Controls.Add _
(Type:=msoControlButton)
With MenuItem
.Caption = "Page Format"
.FaceId = 0
' .OnAction = "Personal_Page_Format"
End With
Set MenuItem = NewMenu.Controls.Add _
(Type:=msoControlButton)
With MenuItem
.Caption = "Planning Project Date"
.FaceId = 0
' .OnAction = "perPlanningProjectDate" -<----------------------
get error here
End With
I have Excel 2003 menu, In Excel 2007 can not able to user. Any
suggestion ?
Const XMENU = "PERSONAL"
Sub Auto_open()
'~~ VBA
Call PerActiveMenu
End Sub
Sub Auto_close()
Call PerDeleteMenu
End Sub
Sub PerDeleteMenu()
On Error Resume Next
CommandBars(1).Controls(XMENU).Delete
End Sub
Sub PerActiveMenu()
'~~ Sub menu
Dim HelpMenu As CommandBarControl
Dim NewMenu As CommandBarPopup
Dim MenuItem As CommandBarControl
Dim SubMenuItem As CommandBarControl
'~~ delete the menu if it already exists
Call PerDeleteMenu
'~~ find the help Menu
Set HelpMenu = CommandBars(1).FindControl(ID:=30010)
If HelpMenu Is Nothing Then
Set NewMenu = CommandBars(1).Controls _
.Add(Type:=msoControlPopup, temporary:=True)
Else
Set NewMenu = CommandBars(1).Controls _
.Add(Type:=msoControlPopup, before:=HelpMenu.Index, _
temporary:=True)
End If
'~~ Add a caption for the menu
NewMenu.Caption = XMENU
'~~ First Menu Item
Set MenuItem = NewMenu.Controls.Add _
(Type:=msoControlButton)
With MenuItem
.Caption = "Page Format"
.FaceId = 0
' .OnAction = "Personal_Page_Format"
End With
Set MenuItem = NewMenu.Controls.Add _
(Type:=msoControlButton)
With MenuItem
.Caption = "Planning Project Date"
.FaceId = 0
' .OnAction = "perPlanningProjectDate" -<----------------------
get error here
End With