View Full Version : Solved: Autocad - run routine when switching Layouts

01-19-2006, 07:37 AM
As the title says, I want a routine to run when the user changes layouts by clicking on the model/layout tabs.


01-19-2006, 12:29 PM
I found the code in acad's help/example files. Place the below code in the ThisDocument code pane. Replace the msgbox with your macro. Note: this maco should be a publically available macro.

Private Sub AcadDocument_LayoutSwitched(ByVal LayoutName As String)
' This example intercepts a drawing LayoutSwitched event.
' This event is triggered when the user switches to a different
' drawing layout view.
' To trigger this example event: Open a drawing and change its layout view
' For example: Switch the drawing from Model view to Layout1 view
' Use the "LayoutName" variable to determine the which layout view we changed to
MsgBox "The drawing layout was just changed to: " & LayoutName
End Sub