HOW TO
Note: This article pertains to ArcGIS versions 8.x. Later versions of ArcGIS may contain different functionality, as well as different names and locations for menus, commands and geoprocessing tools.
Instructions provided describe how to rotate text programmatically. When setting the Angle property on an ITextSymbol object, the text does not move because the Angle property is not implemented. This is a known issue at ArcGIS 8.1 and 8.2.
Note: Support for Visual Basic for Applications (VBA) for ArcMap and ArcCatalog ended with the ArcGIS 10.2.2 release, and Esri has not included VBA compatibility setups since version 10.5. See: ArcGIS Desktop and VBA Moving Forward
The workaround is to use the interface ITransform2D.
Note: For more information on creating a UIControl, see the ArcGIS Desktop Help topic: 'Creating custom commands with VBA and UI Controls'
Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pLayout As IPageLayout Set pLayout = pMxDoc.PageLayout Dim pGC As IGraphicsContainer Set pGC = pLayout Dim pFont As IFontDisp Set pFont = New StdFont pFont.Size = 15 pFont.Name = "Arial Black" pFont.Bold = True Dim pTextElem As ITextElement Set pTextElem = New TextElement Dim pTextSym As ITextSymbol Set pTextSym = New TextSymbol '"""""""""""""""""""""""""""""""""""""""""""" '''This line is ignored at ArcGIS 8.1 and 8.2 pTextSym.Angle = 45 '"""""""""""""""""""""""""""""""""""""""" pTextSym.Font = pFont pTextSym.Size = pFont.Size pTextElem.Symbol = pTextSym pTextElem.Text = "TestText" Dim pPoint As IPoint Set pPoint = New Point pPoint.X = 4 pPoint.Y = 5.5 Dim pElem As IElement Set pElem = pTextElem pElem.Geometry = pPoint pGC.AddElement pElem, 0 '''''This is the workaround using angle... Dim pTwoD As ITransform2D Set pTwoD = pElem pTwoD.Rotate pPoint, 0 pMxDoc.ActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing
Get help from ArcGIS experts
Download the Esri Support App