If TypeOf My.ArcMap.Document.ActiveView Is IPageLayout Then MsgBox("Switch to Data View to run the tool") Return End If
Protected Overloads Overrides Sub OnUpdate() ' Disabled if in Layer View If TypeOf My.ArcMap.Document.ActiveView Is IPageLayout Then Me.Enabled = False ElseIf TypeOf My.ArcMap.Document.ActiveView Is IMap Then Me.Enabled = True End If End Sub