<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic how to use macro and .bas file in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-use-macro-and-bas-file/m-p/723581#M19295</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have some vba code (below) and a .bas file that I'm trying to add to add as an available macro tool. I've loaded the code into the normal.mxt ThisDocument page. I then loaded the .bas file into the modules folder as a new module. But when I go to Tools -&amp;gt; Customize -&amp;gt; Commands tab -&amp;gt; Macros the macro does not appear as a command option. Can anyone guide me here or point me to a helpful site. I had done this before successfully.... but have since gotten a new computer. The macros runs through rasters in a project and exports pngs for each one. Any help is appreciated.&amp;nbsp; What am I doing wrong?!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DJ&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; 
Private Sub ExportRFPMaps_Click()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'MapTasks.ZoomToLayer
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Create variables for map and extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMxDoc As IMxDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMap As IMap
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pActiveView As IActiveView
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pEnv As IEnvelope
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim strTitle As String
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set the current map
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMxDoc = ThisDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMap = pMxDoc.FocusMap
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pActiveView = pMap
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Loop through the RFP layers turning them on, setting the map title and exporting a .png
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Make sure all RFP layers are off when running the tool or one layer may show up in another's view
&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 1 To pMap.LayerCount - 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If pMap.Layer(i) Is Nothing Then Exit Sub 'Test that there is a layer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pActiveView.Extent = pMap.Layer(i).AreaOfInterest 'Set the extent to the layers extent
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pEnv = pActiveView.Extent 'Set the envelope object equal to the current extent
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEnv.Expand 1.1, 1.1, True 'Expand the envelope by 10%
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pActiveView.Extent = pEnv 'Set the extent equal to the expanded envelope
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pMap.Layer(i).Visible = True 'Make current layer visible
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strTitle = MapTasks.FormatTitle(pMap.Layer(i).Name) 'Format the title into two lines
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call MapTasks.ChangeTitle(strTitle) 'Assign the map title with the change title subc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call MapTasks.ExportMap("Z:\Informatics\S031\analyses\RossSeaMPA\Modeling\images\eucl_dist\" &amp;amp; pMap.Layer(i).Name &amp;amp; ".png") 'Export map with export map sub
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Turn the layer off unless its the last layer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If i = pMap.LayerCount - 1 Then pMap.Layer(i).Visible = True Else pMap.Layer(i).Visible = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; Next
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Let user know when its done
&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "Export Complete!&amp;nbsp; Files exported to:" &amp;amp; vbCrLf &amp;amp; "Z:\Informatics\S031\analyses\RossSeaMPA\Modeling\images\eucl_dist", vbOKOnly
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
End Sub
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 May 2010 22:35:45 GMT</pubDate>
    <dc:creator>DennisJongsomjit</dc:creator>
    <dc:date>2010-05-26T22:35:45Z</dc:date>
    <item>
      <title>how to use macro and .bas file</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-use-macro-and-bas-file/m-p/723581#M19295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have some vba code (below) and a .bas file that I'm trying to add to add as an available macro tool. I've loaded the code into the normal.mxt ThisDocument page. I then loaded the .bas file into the modules folder as a new module. But when I go to Tools -&amp;gt; Customize -&amp;gt; Commands tab -&amp;gt; Macros the macro does not appear as a command option. Can anyone guide me here or point me to a helpful site. I had done this before successfully.... but have since gotten a new computer. The macros runs through rasters in a project and exports pngs for each one. Any help is appreciated.&amp;nbsp; What am I doing wrong?!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DJ&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; 
Private Sub ExportRFPMaps_Click()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'MapTasks.ZoomToLayer
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Create variables for map and extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMxDoc As IMxDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMap As IMap
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pActiveView As IActiveView
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pEnv As IEnvelope
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim strTitle As String
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set the current map
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMxDoc = ThisDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMap = pMxDoc.FocusMap
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pActiveView = pMap
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Loop through the RFP layers turning them on, setting the map title and exporting a .png
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Make sure all RFP layers are off when running the tool or one layer may show up in another's view
&amp;nbsp;&amp;nbsp;&amp;nbsp; For i = 1 To pMap.LayerCount - 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If pMap.Layer(i) Is Nothing Then Exit Sub 'Test that there is a layer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pActiveView.Extent = pMap.Layer(i).AreaOfInterest 'Set the extent to the layers extent
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pEnv = pActiveView.Extent 'Set the envelope object equal to the current extent
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEnv.Expand 1.1, 1.1, True 'Expand the envelope by 10%
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pActiveView.Extent = pEnv 'Set the extent equal to the expanded envelope
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pMap.Layer(i).Visible = True 'Make current layer visible
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strTitle = MapTasks.FormatTitle(pMap.Layer(i).Name) 'Format the title into two lines
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call MapTasks.ChangeTitle(strTitle) 'Assign the map title with the change title subc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call MapTasks.ExportMap("Z:\Informatics\S031\analyses\RossSeaMPA\Modeling\images\eucl_dist\" &amp;amp; pMap.Layer(i).Name &amp;amp; ".png") 'Export map with export map sub
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Turn the layer off unless its the last layer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If i = pMap.LayerCount - 1 Then pMap.Layer(i).Visible = True Else pMap.Layer(i).Visible = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; Next
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Let user know when its done
&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "Export Complete!&amp;nbsp; Files exported to:" &amp;amp; vbCrLf &amp;amp; "Z:\Informatics\S031\analyses\RossSeaMPA\Modeling\images\eucl_dist", vbOKOnly
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
End Sub
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 May 2010 22:35:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-use-macro-and-bas-file/m-p/723581#M19295</guid>
      <dc:creator>DennisJongsomjit</dc:creator>
      <dc:date>2010-05-26T22:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to use macro and .bas file</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-use-macro-and-bas-file/m-p/723582#M19296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;have you tried making the method public?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 12:19:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-use-macro-and-bas-file/m-p/723582#M19296</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2010-05-27T12:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to use macro and .bas file</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-use-macro-and-bas-file/m-p/723583#M19297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hmm.&amp;nbsp; Thanks for the tip.&amp;nbsp; However...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed it to Public and that allowed me to access the macro and add it to my toolbar.&amp;nbsp; But, it's acting funny now.&amp;nbsp; I wonder if it has to do with the change from 9.2 to 9.3.1 (given that it worked before without a hitch)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I have one or no grids loaded the macro seemingly works correctly (get a success message) but no image is created.&amp;nbsp; It checks for layers so it's odd that it doesn't balk when there are no grids loaded.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I have two or more grids loaded it brings up an error "Invalid procedure call or argument".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've included the code from the .bas module I created within my normal.mxt modules folder.&amp;nbsp; Got a chance to look it over for obvious errors?&amp;nbsp; Thanks again for any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

Public Sub ChangeTitle(txtTitle As String)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Create variables for map
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMxDoc As IMxDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pActiveView As IActiveView
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Create variables for the graphics
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pGraphicsContainer As IGraphicsContainer
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pElement As IElement
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pTextElement As ITextElement
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set the current map, layout, and graphics container
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMxDoc = ThisDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pActiveView = pMxDoc.ActiveView
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pPageLayout = pMxDoc.PageLayout
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pGraphicsContainer = pPageLayout
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMSF As IMapSurroundFrame
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMS As IMapSurround
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Reset the graphics container list to return the first graphic
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'The text title is the first graphic on the page layout because it is at the top of the order
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'If you change the order of the text title the following code will not work
&amp;nbsp;&amp;nbsp;&amp;nbsp; pGraphicsContainer.Reset
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pElement = pGraphicsContainer.Next
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pTextElement = pElement
&amp;nbsp;&amp;nbsp;&amp;nbsp; pTextElement.Text = txtTitle 'This actualy changes the title.
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Refresh all the map elements
&amp;nbsp;&amp;nbsp;&amp;nbsp; pGraphicsContainer.Reset
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pElement = pGraphicsContainer.Next
&amp;nbsp;&amp;nbsp;&amp;nbsp; Do Until pElement Is Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If TypeOf pElement Is IMapSurroundFrame Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMSF = pElement
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMS = pMSF.MapSurround
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pMS.Refresh
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pMxDoc.ActiveView.Refresh

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pElement = pGraphicsContainer.Next
&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
End Sub

Public Sub ExportMap(strFileName As String)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Create variables for map and extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMxDoc As IMxDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMap As IMap
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pActiveView As IActiveView
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pEnv As IEnvelope
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set the current map
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMxDoc = ThisDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMap = pMxDoc.FocusMap
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pActiveView = pMap
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Create export object and set the resolution
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pExport As IExport
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pExport = New ExportPNG
&amp;nbsp;&amp;nbsp;&amp;nbsp; pExport.Resolution = 450
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set the export frame
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim exportRECT As tagRECT
&amp;nbsp;&amp;nbsp;&amp;nbsp; exportRECT = pMxDoc.ActiveView.ExportFrame

&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set the size and extent of the export
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pPixelBoundsEnv As IEnvelope
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pPixelBoundsEnv = New Envelope
&amp;nbsp;&amp;nbsp;&amp;nbsp; pPixelBoundsEnv.PutCoords exportRECT.Left, exportRECT.bottom, exportRECT.Right, exportRECT.Top
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'pPixelBoundsEnv.PutCoords 0, 2477, 4050, 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; pExport.PixelBounds = pPixelBoundsEnv
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Create a cancel object
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pCancel As ITrackCancel
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pCancel = New CancelTracker
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Set file name and export map
&amp;nbsp;&amp;nbsp;&amp;nbsp; pExport.ExportFileName = strFileName
&amp;nbsp;&amp;nbsp;&amp;nbsp; pMxDoc.ActivatedView.Output pExport.StartExporting, pExport.Resolution, exportRECT, Nothing, pCancel
&amp;nbsp;&amp;nbsp;&amp;nbsp; pExport.FinishExporting
&amp;nbsp;&amp;nbsp;&amp;nbsp; pExport.Cleanup
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
End Sub

Public Function FormatTitle(strTitle As String) As String
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim strFirstLine As String
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim strSecondLine As String
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim lngLength As Long
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim lngPosition As Long
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; lngLength = Len(strTitle)
&amp;nbsp;&amp;nbsp;&amp;nbsp; lngPosition = InStr(strTitle, "Return Flow Plot")
&amp;nbsp;&amp;nbsp;&amp;nbsp; strFirstLine = Left(strTitle, lngPosition - 1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; strSecondLine = Right(strTitle, lngLength - lngPosition + 1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; FormatTitle = strFirstLine &amp;amp; vbCrLf &amp;amp; strSecondLine
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
End Function

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:57:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-use-macro-and-bas-file/m-p/723583#M19297</guid>
      <dc:creator>DennisJongsomjit</dc:creator>
      <dc:date>2021-12-12T06:57:08Z</dc:date>
    </item>
  </channel>
</rss>

