明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1385|回复: 1

求助~!!~!~vba中写autocad的3级菜单!~

[复制链接]
发表于 2006-5-25 00:18:00 | 显示全部楼层 |阅读模式

Option Explicit
Public DirPath As String


Sub AddASubMenu()
    '获得当前的菜单组
    Dim currMenuGroup As AcadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)
    ' 创建新菜单
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("ttttttttttttt(&K)" & Chr(Asc("&")))
    '添加菜单项
    Dim macro As String
    macro = Chr(vbKeyEscape) + Chr(vbKeyEscape)     '相当于按下两次Esc键
    '--------------------------------------------------------------------------------------
    '创建知识库(&C)
    Dim ID_Create  As AcadPopupMenuItem
    Set ID_Create = newMenu.AddMenuItem(newMenu.Count + 1, Chr(Asc("&")) & "创建知识库(&C)", macro & "_open ")
    '分隔线
    Dim menuItemSeparator As AcadPopupMenuItem
    Set menuItemSeparator = newMenu.AddSeparator(newMenu.Count + 1)
   
    '--------------------------------------------------------------------------------------
    '知识查询(&Q)
    Dim ID_Query As AcadPopupMenu
    Set ID_Query = newMenu.AddSubMenu(newMenu.Count + 1, Chr(Asc("&")) & "知识查询(&Q)")
    '子菜单项目1:设计手册
    Dim ID_book As AcadPopupMenuItem
    Set ID_book = ID_Query.AddMenuItem(ID_Query.Count + 1, Chr(Asc("&")) & "设计手册(&B)", macro & "-vbarun" + Chr(32) + "ThisDrawing.vbahelp" + Chr(32))

    ' 在菜单栏上显示菜单
    newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.Count + 1)
 
   
End Sub

我想在 子菜单项目1:设计手册 后面在加上一个3级菜单 螺丝手册。。铸件手册。。等等

望会人告诉我怎么写!~!谢谢楼主!~

发表于 2006-5-29 18:41:00 | 显示全部楼层
提示:ThisDrawing.vbahelp的宏找不到!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 02:20 , Processed in 0.165497 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表