cityhunter
路人甲
路人甲
  • 注册日期2004-10-14
  • 发帖数62
  • QQ
  • 铜币258枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1505回复:1

VBA+arcMap 创建新菜单能否用自己的

楼主#
更多 发布于:2007-06-13 16:52
<P>在arcmap中利用VBA创建了新菜单,但是菜单关联的命令好像必须是build in command。能不能用菜单调用自己的写的模块啊?或者在VB+AO中创建新菜单后能调用自己的模块吗?我查遍了网页,都是调用系统本身的命令。好像就是可以重新组合一下arcmap自己的命令啊?请高手指点。谢谢!!</P>
<P> '添加菜单<BR>    ' Find the MainMenuBar.<BR>    Dim pMainMenuBar As ICommandBar<BR>    Set pMainMenuBar = Application.Document.CommandBars.Find(ArcID.MainMenu)</P>
<P>    ' Create the new menu called "MyMenu" on the MainMenuBar.<BR>    Dim pNewMenu As ICommandBar<BR>    Set pNewMenu = pMainMenuBar.CreateMenu("计算", 6)</P>
<P>    ' Add a built in command to the new menu.<BR>    ' The built in ArcID module is used to get the command ID for the AddDate command.<BR>    'pNewMenu.Add ArcID.View_StatusBar</P>
<P>     Set pNewMenu = pMainMenuBar.CreateMenu("查询", 7)<BR>    pNewMenu.CreateMacroItem "按属性查询", 2, "ThisDocument.AttributeQuery"</P>
<P>这段代码在ARCMap的VBA中总数报错。提示就是不能调用<BR>    </P>
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15946
  • QQ554730525
  • 铜币25338枚
  • 威望15363点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2007-06-14 10:39
可以自己编写dll来定制菜单并调用相应的模块,这个在软件的帮助的例子里也有
举报 回复(0) 喜欢(0)     评分
游客

返回顶部