以下是正确的教程:- Sub Ch6_InsertMenu()
- ' 为当前菜单组定义变量
- Dim currMenuGroup As AcadMenuGroup
- Set currMenuGroup = ThisDrawing.Application. _
- MenuGroups.Item(0)' 创建新的菜单
- Dim newMenu As AcadPopupMenu
- Set newMenu = currMenuGroup.Menus.Add("TestMenu")' 为菜单项声明变量
- Dim newMenuItem As AcadPopupMenuItem
- Dim openMacro As String' 赋值宏字符串为VB语句"ESC ESC _open "并创建菜单项
- openMacro = Chr(3) + Chr(3) + Chr(95) + "open" + Chr(32)
- Set newMenuItem = newMenu.AddMenuItem(newMenu.Count + 1, _
- "Open", openMacro)' 在菜单条上显示菜单
- currMenuGroup.Menus.InsertMenuInMenuBar "TestMenu", ""
- End Sub
|