Keith™ 发表于 2004-11-6 11:34:58

天啊,一想到。mnu文件惹恼了我LOL
我是有人告诉我早些时候。mnu文件是不必要的,它会节省我很多痛苦。mns文件是所有需要备份和保存的文件。
标记

Keith™ 发表于 2004-11-6 11:59:18

Hi
仅供参考,以下片段来自AutoCAD Online帮助文件-
您最多可以加载和卸载8个部分菜单和最多16个流行菜单。
下拉菜单在***POP1到***POP499菜单部分中定义,快捷菜单在***POP0和***POP500到***POP999部分中定义。下拉菜单最多可以包含999个菜单项。快捷菜单最多可以包含499个菜单项。这两个限制都包括层次结构中的所有菜单。如果菜单文件中的菜单项超过这些限制,AutoCAD将忽略额外的项目。如果下拉菜单或快捷菜单长于可用的显示空间,则将其截断以适应。
祝你愉快,迈克

Keith™ 发表于 2004-11-6 12:17:46

谢谢迈克,这是个好消息
回到VBA,我认为上面的代码不会与加载菜单的模块一起工作
可以这样做,但需要另一种方法
我愿意听取建议
谢谢
马克

Jeff_M 发表于 2004-11-17 20:14:46

嘿Jeff
我看了你上面的小代码示例,它确实帮助我最终完成了我试图做的事情。我想加载一个菜单组并从它中插入一个POP到菜单栏中。所以,我明白了
如果有人感兴趣,我可以发布?
谢谢
马克

Jeff_M 发表于 2004-11-24 09:36:29

好吧,我想发布这个代码,因为我现在已经完成了它。我希望其他人能从中受益。如果您有任何疑问,请随时提问。
马克
-----------------------------------

Sub Load_and_Insert_Menu()
Dim MenuGroup As AcadMenuGroup
Dim PopMenu As AcadPopupMenu
Dim SelectedMenuGroup As String, LoadedPopMenu As String
Dim Retval As Variant
On Error Resume Next
'This part Loads the menu
SelectedMenuGroup = "K:\Directory\Directory\Directory\Menufilename.mnc" '<--- Type in the path to your menufile here.
Set MenuGroup = ThisDrawing.Application.MenuGroups.Load(SelectedMenuGroup, False)
LoadedPopMenu = ("&Pulldown")'Type in the pulldown that you want in the menubar from the above loaded menu.You must include the accelerator (&) if one exists
Set PopMenu = MenuGroup.Menus.Item(LoadedPopMenu)
                  
'This part inserts the pulldown that you typed above in the menubar
PopMenu.InsertInMenuBar 10
If MenuGroup Is Nothing Then                                    
Retval = MsgBox("The "pulldown Menuname" menu is already loaded", vbInformation, "Type whatever you want in the dialog box capion here")
Exit Sub
Else
Retval = MsgBox("The "pulldown Menuname"menu has been successfully loaded", vbInformation, "Type whatever you want in the dialog box capion here")
Exit Sub
End If
End Sub
页: 1 [2]
查看完整版本: 将PopMenu插入菜单栏