I am trying to create a utility which launches a new instance of a specified userform with custom parameters, but I am having trouble passing the desired userform to the utility.
In a module:
Public Sub LaunchForm(MachID As String, FormType As UserForm)
Dim Form As New FormType
With Form
.MachineID = MachID
.Show
End With
End Sub
In the userform from which the form is to be launched:
Private Sub RemovePart32_Click()
LaunchForm "Machine32", RemovePart
End Sub
When I click the "RemovePart32" button, I get a compile error "user defined type not defined". I am guessing that I should pass the userform as a string but I get a type error if I do that and I'm not sure how to get around that. Any advice would be appreciated.