我在 DevBUZZ 论坛中问过同样的问题,我解决了我的问题,这里是更多详细信息的链接:http ://forums.devbuzz.com/How_To_Put_a_Menu_Bar_in_an_Aplication/m_41726/tm.htm
这是使用 CommandBar 执行此操作的代码:
Option Explicit
Private Sub Form_Load()
InitCommandBar
End Sub
Sub InitCommandBar()
Dim mnuMain As CommandbarLib.CommandBarMenuBar
Dim mnuFile As CommandbarLib.Item
Dim mnuEdit As CommandbarLib.Item
Set mnuMain = CommandBar1.Controls.Add(cbrMenuBar, "MainMenu")
'add File menu items
Set mnuFile = mnuMain.Items.Add(1, "File", "File")
mnuFile.SubItems.Add , "Open", "Open"
mnuFile.SubItems.Add , "Add", "Add"
mnuFile.SubItems.Add , "Update", "Update"
mnuFile.SubItems.Add , "Delete", "Delete"
'add Edit menu items
Set mnuEdit = mnuMain.Items.Add(2, "Edit", "Edit")
mnuEdit.SubItems.Add , "Sort", "Sort"
mnuEdit.SubItems.Add , "Find", "Find"
End Sub