明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1358|回复: 0

一份CAD VBA二次开发菜单程序,现在我想给所有子菜单选项加上3选项,谢谢,

[复制链接]
发表于 2011-8-18 10:13:13 | 显示全部楼层 |阅读模式
2明经币

一份CAD VBA二次开发菜单程序,现在我想给所有子菜单选项加上3选项,谢谢,我是新手,麻烦给详细代码,谢谢


Public ifnew As Boolean
Public ifjx As Boolean
Public ifexit As Boolean
Public textstr As String


Public Sub acadmenu()    '''''自动加载acadstartup()       '生工具下拉菜单
Dim newmenugroup As AcadMenuGroup
Dim newmenu As AcadPopupMenu
Dim newmenuitemname1 As AcadPopupMenuItem
Dim newmenuitemname2 As AcadPopupMenuItem
Dim newmenuitemname3 As AcadPopupMenuItem
Dim newmenuitemname4 As AcadPopupMenuItem
Dim newmenuitemname5 As AcadPopupMenuItem
Dim newmenuitemname6 As AcadPopupMenuItem
Dim newmenuitemname7 As AcadPopupMenuItem
Dim newmenuitemname8 As AcadPopupMenuItem
Dim newmenuitemname9 As AcadPopupMenuItem
Dim newmenuitemname10 As AcadPopupMenuItem
Dim newmenuitemname11 As AcadPopupMenuItem
Dim newmenuitemname12 As AcadPopupMenuItem
Dim newmenuitemname13 As AcadPopupMenuItem
Dim newmenuitemname14 As AcadPopupMenuItem
Dim newmenuitemname15 As AcadPopupMenuItem
Dim newmenuitemname16 As AcadPopupMenuItem
Dim macrostr1 As String
Dim macrostr2 As String
Dim macrostr3 As String
Dim macrostr4 As String
Dim macrostr5 As String
Dim macrostr6 As String
Dim macrostr7 As String
Dim macrostr8 As String
Dim macrostr9 As String
Dim macrostr10 As String
Dim macrostr11 As String
Dim macrostr12 As String
Dim macrostr13 As String


Dim acadpref As AcadPreferences
Dim my As Variant
Dim ifok As String
Dim ifno As String
On Error Resume Next


Dim filepath As String
Open filepath For Output As #1
Print #1, Format(num + 1, "0.00")
Close #1
Set acadpref = ThisDrawing.Application.Preferences
acadpref.Display.CursorSize = 100                               '将十字光标设为全屏幕
acadpref.Display.DockedVisibleLines = 4          '控制命令行的行数
ThisDrawing.Utility.Prompt Chr(13) + " 欢迎绘图小蜜,如有修改补充意见,请致电:(作者:郑玉平 TEL:18602843076)"
Set newmenugroup = ThisDrawing.Application.MenuGroups.Item(0)
Set newmenu = newmenugroup.Menus.Add("绘图小蜜" + Chr(Asc("&")) + "(B)")


macrostr1 = "-vbarun shuiqu.a "
macrostr2 = "-vbarun shuiqu.numssg1ok "
macrostr3 = "-vbarun shuiqu.dsfdsfds "
macrostr4 = "-vbarun shuiqu.qiaohanbiaozhu "
macrostr5 = "-vbarun shuiqu.textzj "
macrostr6 = "-vbarun shuiqu.textzj "
macrostr7 = "-vbarun module2.tesssszj "
macrostr8 = "-vbarun module5.zjbg1 "
macrostr9 = "-vbarun shuiqu.textzj "
macrostr10 = "-vbarun shuiqu.xgtextTT "
macrostr11 = "-vbarun kjj.shanchu3 "
macrostr12 = "-vbarun kjj.shanchu4 "
macrostr13 = "-vbarun shuiqu.a "
macrostr14 = "-vbarun shuiqu.SubMacro "
Set newmenuitemname1 = newmenu.AddMenuItem(newmenu.Count + 1, "**绘图小蜜**", macrostr1)
Set newmenuitemname2 = newmenu.AddSeparator(newmenu.Count + 2)
Set newmenuitemname3 = newmenu.AddMenuItem(newmenu.Count + 3, "断面采集" + Chr(Asc("&")) + "B", macrostr2)
Set newmenuitemname4 = newmenu.AddMenuItem(newmenu.Count + 4, "渠道标注" + Chr(Asc("&")) + "A", macrostr3)          '加分隔线
Set newmenuitemname5 = newmenu.AddMenuItem(newmenu.Count + 5, "涵洞标注" + Chr(Asc("&")) + "C", macrostr4)
Set newmenuitemname6 = newmenu.AddMenuItem(newmenu.Count + 6, "断面采集" + Chr(Asc("&")) + "D", macrostr5)
Set newmenuitemname7 = newmenu.AddSeparator(newmenu.Count + 7)
Set newmenuitemname8 = newmenu.AddMenuItem(newmenu.Count + 8, "断面采集" + Chr(Asc("&")) + "J", macrostr6)          '加分隔线
Set newmenuitemname9 = newmenu.AddMenuItem(newmenu.Count + 9, "断面采集" + Chr(Asc("&")) + "E", macrostr7)
Set newmenuitemname10 = newmenu.AddMenuItem(newmenu.Count + 10, "断面采集" + Chr(Asc("&")) + "f", macrostr8)
Set newmenuitemname11 = newmenu.AddSeparator(newmenu.Count + 11)
Set newmenuitemname12 = newmenu.AddMenuItem(newmenu.Count + 12, "文字注记" + Chr(Asc("&")) + "D", macrostr9)
Set newmenuitemname13 = newmenu.AddMenuItem(newmenu.Count + 13, "文字替换" + Chr(Asc("&")) + "J", macrostr10)          '加分隔线
Set newmenuitemname14 = newmenu.AddMenuItem(newmenu.Count + 14, "图层开启" + Chr(Asc("&")) + "G", macrostr11)
Set newmenuitemname15 = newmenu.AddMenuItem(newmenu.Count + 15, "图层关闭" + Chr(Asc("&")) + "N", macrostr12)
Set newmenuitemname16 = newmenu.AddMenuItem(newmenu.Count + 16, "帮    助" + Chr(Asc("&")) + "M", macrostr13)

newmenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.Count + 1)       '装进下拉菜单

End Sub

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-2-27 20:12 , Processed in 0.179480 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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