试试以下程序,在VBA调试通过,你可以改到VB中:
- Sub AddButton()
- Dim cmg As AcadMenuGroup
- Dim ntb As AcadToolbar
- Dim ntbb As AcadToolbarItem
- Dim com As String
- Set cmg = MenuGroups.Item(0)
- 'cmg.Toolbars("GJT").Delete
- Set ntb = cmg.Toolbars.Add("GJT")
- com = Chr(3) & Chr(3) & Chr(16) & "(startapp""notepad.exe"")(princ)" & Chr(16) & vbCr
- Set ntbb = ntb.AddToolbarButton(ntb.Count + 1, "Open", "Open Macro", com, False)
- End Sub
|