Loading a macro from a toolbar button
I have written a VBA macro that prints the layout name of the selected paper space page on that page. This is useful for referring to a particular layout during the design process.
Sub ThisLayoutText()
Dim layText As AcadText
Dim objLayout As AcadLayout
Set objLayout = ThisDrawing.ActiveLayout
Dim layName As String
layName = objLayout.Name
Dim insPt(0 To 2) As Double: insPt(0) = 5: insPt(1) = 6
Dim dHeight As Double
dHeight = 4
Set layText = ThisDrawing.PaperSpace.AddText(layName, insPt, dHeight)
layText.Update
ThisDrawing.Application.ZoomExtents
End Sub
This works fine but I want to run the macro from a toolbar button. How do I create a new button and link it to my macro?
Regards
Jeremy
Comments
-
Use -VBARUN or with lisp vl-vbarun
you could also consider using a FIELD that references the current layout CTAB.
0 -
This is a POP menu example.
[Drainage schedule]^C^C(vl-vbaload "P:/AutoDESK/VBA/Drainage.dvb") (vl-vbarun "Drainage")
0