AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 1,835
- Office Version
- 2019
- 2016
- Platform
- Windows
Excel seems to allow a Userform to be passed to Sub MCF in module1 but it doesn't work as expected
The command fMain.Caption doesn't print in the Caption area but on the Form itself, and fMain.show errors with Object doesn't support this property or method
What am I doing wrong ? The reason for passing the Form itself to the module (which creates some controls at run time), is so they can be created for whichever form is pased in. Or so is hoped.
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.row > 1 Then
Cancel = True
Select Case Target.Column
Case 3
MCF SelRow, frmSerial
End Select
End If
End Sub
Sub MCF(SelRow As Range, fMain As UserForm)
fMain.show
With SelRow
fMain.Caption = "ThisCaption"
End With
End sub
The command fMain.Caption doesn't print in the Caption area but on the Form itself, and fMain.show errors with Object doesn't support this property or method
What am I doing wrong ? The reason for passing the Form itself to the module (which creates some controls at run time), is so they can be created for whichever form is pased in. Or so is hoped.