3 Replies Latest reply on Jun 3, 2010 7:12 PM by flederfauz

    How to call a Module with antother Module in VBA!

    flederfauz
      Hi!

      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?

      Private 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

      Thanks for your help