
Originally Posted by
yudlugar
well you just could set a hidden textbox on the userform to carry the property.
True. But I wanted to know if it could be determined from the form without passing anything to determine how it was called.

Originally Posted by
yudlugar
Alternatively, I suppose
UserForm1.show
would return an error if it was already displayed modally, whereas it would not return an error if it was displayed modelessly. So you could use that to test.
Bingo. That's what helped me solve it. +1
Private Sub CommandButton1_Click()
MsgBox "This form is " & IIf(IsFormModeless = True, "Modeless", "Modal")
End Sub
Private Function IsFormModeless() As Boolean
On Error GoTo ErrorHandler
Me.Show vbModeless
On Error GoTo 0
IsFormModeless = True
Exit Function
ErrorHandler:
'If Err.Number = 401 Then
On Error GoTo 0
IsFormModeless = False
End Function
Bookmarks