"Optional" output of a Public Type record
Re your follow-up question, which I seem unable to reply directly to:
If I follow, maybe workaround with something like this
Private Type uType
a As Long
b As String
End Type
Private muRec As uType
Private mbUseRec As Boolean
Sub Test1()
Dim n As Long, s As String
n = 123
s = "ABC"
MsgBox foo(n, s)
End Sub
Sub Test2()
Dim n As Long, s As String
Dim uRec As uType
With uRec
.a = 456
.b = "XYZ"
End With
muRec = uRec
mbUseRec = True
MsgBox foo(n, s)
mbUseRec = False ' < don't forget
End Sub
Function foo(n As Long, s As String) As String
If mbUseRec Then
With muRec
foo = .a & .b
End With
Else
foo = n & s
End If
End Function
FWIW I wouldn't do it like that myself!
Regards,
Peter T
|