title: How to use an object from another userform in vbscript?
body: <p>I am working with multiple userforms in vbscript.</p>
  
  <p>I am creating an object in a userform and trying to call it in another userform.
  I tried declaring the object as Public in both the userforms but still I am not able to acess the object from another userform.</p>
  
  <p>Look Forward for your help.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Userform1:</p>
  
  <pre><code>        Public Inner_V1 As Object
          Private Sub Inner_V1_CD_Click()
  
   'Auswahlfenster ausblenden
    Input_selection2.Hide
  
  'Dim myDoc As Document
  Set myDoc = CATIA.ActiveDocument
  
  On Error Resume Next
  
  Set ActivePart = CATIA.ActiveDocument.Part
  
      If Err.Number &lt;&gt; 0 Then
          On Error GoTo 0
          Box = MsgBox("Das geöffnete Dokument ist kein CATPart!" + Chr(10) + "Das Makro wird beendet", vbExclamation, "Falscher Dateityp")
          Unload Input_selection2
          Exit Sub
      End If
  
  ' Selektion definieren und leeren ----
  Dim UserSel As Object
  Set UserSel = myDoc.Selection
  UserSel.Clear
  '-------------------------------------
  
  ' User wählt die Fläche aus #############################################################################
  
      ' Auswahl festlegen -------------------
      Dim Was1(0)
      Was1(0) = "HybridShape"
      '--------------------------------------
  
      Dim Auswahl                                         'Wird für die SelectElement2 Methode benötigt (Auswahl durch User)
      Auswahl = UserSel.SelectElement2(Was1, "Bitte die Fläche auswählen.", False)
  
      If Auswahl = "Normal" Then
          Set Inner_V1 = UserSel.Item(1).Value
          Inner_V1.Value = Inner_V1.Name
      Else
          Unload Input_selection2
          Exit Sub
      End If
  
      ' Selektion freigeben -----------------------------------------------------
      UserSel.Clear                           'User-Auswahl löschen
  
    'Auswahlfenster anzeigen
     Input_selection2.Show
  
     End Sub
  </code></pre>
  
  <p>Userform2:</p>
  
  <pre><code>           Private Sub Weiter_Click()
  
             Set hybridBodies1 = part1.HybridBodies
  
             Set hybridBody1 = hybridBodies1.Add()
             hybridBody1.Name = "test"
  
             Set reference1 = part1.CreateReferenceFromObject(Inner_V1)
             Set reference2 = part1.CreateReferenceFromObject(Guide_curve)
  
             Set sweep_v1 = hybridShapeFactory1.AddNewSweepExplicit(reference1, reference2)
             Set reference3 = part1.CreateReferenceFromObject(Support_V)
  
             hybridBody1.AppendHybridShape sweep_v1
  
             End Sub   
  </code></pre>
  
  <p>Here, Inner_V1 is the object which i Need to use from Userform1.</p>