<?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 call a Module with antother Module in VBA! in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-call-a-module-with-antother-module-in-vba/m-p/156531#M4093</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;What I am looking for is very basic. I have a project containing two modules. Now I want to call one module by the other module. What I mean is I want the second module to be executed by the first module. I thought the "call" command would be the right way to do but I always get an error message. I also tried writing in brackets ("Process1") but this didnt work as well. Any suggestion what command to use? Has this something to do with private and public subs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Sub Testprocess()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pMxDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeatLayer As IFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeatureClass As IFeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeatureCursor As IFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pField As IField&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeature As IFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pMxDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatLayer = pMxDoc.FocusMap.Layer(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatureClass = pFeatLayer.FeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatureCursor = pFeatureClass.Search(Nothing, False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeature = pFeatureCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim n As Integer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pProcessID As Integer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Do Until pFeature Is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pProcessID = pFeature.Value(pFeature.Fields.FindField("Process_ID"))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; If (pProcessID = 1) Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;BR /&gt;&amp;nbsp; Call Process1&lt;BR /&gt; &lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Else: End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeature = pFeatureCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 May 2010 07:39:20 GMT</pubDate>
    <dc:creator>chriss_</dc:creator>
    <dc:date>2010-05-31T07:39:20Z</dc:date>
    <item>
      <title>How to call a Module with antother Module in VBA!</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-call-a-module-with-antother-module-in-vba/m-p/156531#M4093</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;What I am looking for is very basic. I have a project containing two modules. Now I want to call one module by the other module. What I mean is I want the second module to be executed by the first module. I thought the "call" command would be the right way to do but I always get an error message. I also tried writing in brackets ("Process1") but this didnt work as well. Any suggestion what command to use? Has this something to do with private and public subs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Sub Testprocess()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pMxDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeatLayer As IFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeatureClass As IFeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeatureCursor As IFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pField As IField&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeature As IFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pMxDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatLayer = pMxDoc.FocusMap.Layer(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatureClass = pFeatLayer.FeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatureCursor = pFeatureClass.Search(Nothing, False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeature = pFeatureCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim n As Integer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pProcessID As Integer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Do Until pFeature Is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pProcessID = pFeature.Value(pFeature.Fields.FindField("Process_ID"))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; If (pProcessID = 1) Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;BR /&gt;&amp;nbsp; Call Process1&lt;BR /&gt; &lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Else: End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeature = pFeatureCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 May 2010 07:39:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-call-a-module-with-antother-module-in-vba/m-p/156531#M4093</guid>
      <dc:creator>chriss_</dc:creator>
      <dc:date>2010-05-31T07:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to call a Module with antother Module in VBA!</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-call-a-module-with-antother-module-in-vba/m-p/156532#M4094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;yes, if a Sub or Function is declared as Private in another module, you cannot call it from another module. You can call it only on the same module.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jun 2010 20:15:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-call-a-module-with-antother-module-in-vba/m-p/156532#M4094</guid>
      <dc:creator>JunFolledo</dc:creator>
      <dc:date>2010-06-03T20:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to call a Module with antother Module in VBA!</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-call-a-module-with-antother-module-in-vba/m-p/156533#M4095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just make the Declaration of the&amp;nbsp; procedures (subs) public.&amp;nbsp; It should look something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Public Sub Testprocess()

Dim pMxDoc As IMxDocument
Dim pFeatLayer As IFeatureLayer
Dim pFeatureClass As IFeatureClass
Dim pFeatureCursor As IFeatureCursor
Dim pField As IField
Dim pFeature As IFeature
Set pMxDoc = ThisDocument
Set pFeatLayer = pMxDoc.FocusMap.Layer(0)
Set pFeatureClass = pFeatLayer.FeatureClass
Set pFeatureCursor = pFeatureClass.Search(Nothing, False)
Set pFeature = pFeatureCursor.NextFeature
Dim n As Integer

Dim pProcessID As Integer

Do Until pFeature Is Nothing
pProcessID = pFeature.Value(pFeature.Fields.FindField("Process_ ID"))
If (pProcessID = 1) Then

Call Process1


Else: End If

Set pFeature = pFeatureCursor.NextFeature
Loop

End Sub&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:18:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-call-a-module-with-antother-module-in-vba/m-p/156533#M4095</guid>
      <dc:creator>RuchiraWelikala</dc:creator>
      <dc:date>2021-12-11T08:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to call a Module with antother Module in VBA!</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-call-a-module-with-antother-module-in-vba/m-p/156534#M4096</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;Thanks. I figured it out&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jun 2010 02:12:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-call-a-module-with-antother-module-in-vba/m-p/156534#M4096</guid>
      <dc:creator>chriss_</dc:creator>
      <dc:date>2010-06-04T02:12:38Z</dc:date>
    </item>
  </channel>
</rss>

