Sub Ch6_AddButton() Dim currMenuGroup As AcadMenuGroup Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)
' 建立一个新工具栏 Dim newToolbar As AcadToolbar Set newToolbar = currMenuGroup.Toolbars.Add("TestToolbar")
' 在新工具栏上增加一个按钮 Dim newButton As AcadToolbarItem Dim openMacro As String
' 赋值这个宏的VB表达式为"ESC ESC _open " openMacro = Chr(3) + Chr(3) + Chr(95) + "open" + Chr(32) Set newButton = newToolbar.AddToolbarButton _ ("", "NewButton", "Open a file.", openMacro) End Sub
|