Using Excel 2007 with Excel 2003 template


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
 
Ad

Advertisements

G

GS

moonhk laid this down on his screen :
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

Did you check the Addins tab to see if your menu was listed in the
Custom Menus group?

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top