Public Sub test() ' Get the map and the graphics container for it Dim pMap As IMap Dim pMXDocument As IMxDocument Set pMXDocument = ThisDocument Set pMap = pMXDocument.FocusMap Dim pGraphicsContainer As IGraphicsContainer Set pGraphicsContainer = pMap ' Get the first element Dim pElement As IElement pGraphicsContainer.Reset Set pElement = pGraphicsContainer.Next ' Get the name property and display Dim pElementProperties As IElementProperties Set pElementProperties = pElement MsgBox pElementProperties.Name ' Get the width and height and display Dim pEnvelope As IEnvelope Set pEnvelope = New Envelope Dim pDisplay As IDisplay Set pDisplay = pMXDocument.ActiveView.ScreenDisplay pElement.QueryBounds pDisplay, pEnvelope MsgBox CStr(pEnvelope.Width), vbInformation, "width" MsgBox CStr(pEnvelope.Height), vbInformation, "height" End Sub
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.