RawlinsCross
Active Member
- Joined
- Sep 9, 2016
- Messages
- 437
I have an interesting problem where I have a userform (DataEntry) from which I can launch multiple instances of another userform (DataEntryDetails). Both are launched vbModeless. Say I have 1 instance of userform DataEntry open and 3 instances of userform DataEntryDetails. Now if I minimize Excel, Excel will close down all 3 instances of userform DataEntryDetails while keeping open DataEntry. The net effect is that when I maximize the screen, all I see now is the DataEntry userform.
I've tested this situation with the code below which returns 1. Any thoughts of what is going on here?
I've tested this situation with the code below which returns 1. Any thoughts of what is going on here?
VBA Code:
Private Sub Workbook_WindowResize(ByVal Wn As Window)
Dim frm As Object
If Wn.WindowState = xlMaximized Then
For Each frm In VBA.UserForms
If frm.Name = "DataEntryDetails" Then
MsgBox "The DataEntryDetails userform still exists!" 'This does not run at all
End If
Next frm
MsgBox VBA.UserForms.Count 'Returns 1 even though I had 4 userforms open
End If
End Sub