I am working with multiple userforms in vbscript.
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.
Look Forward for your help.
Thanks in advance.
Userform1:
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 <> 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
Userform2:
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
Here, Inner_V1 is the object which i Need to use from Userform1.