OK, still preliminary and not 100% consistently reproduced, but I think I'm getting close. My userform runs at Workbook_Open with this code:
With UserForm1
.StartUpPosition = 0
.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
.Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
.Show
End With
Now, in the userform is this code:
Private Sub CommandButton1_Click()
If Not IsSelected(ListBox1) Then
MsgBox "Please select user."
Exit Sub
End If
If Not IsSelected(ListBox2) Then
MsgBox "Please select process."
Exit Sub
End If
Me.Hide
End Sub
So now I'm wondering if the Me.Hide command is leaving the userform open and somehow causing this problem when the workbook changes focus.
I'm continuing to test by commenting out the userform show section of the workbook_open event with a set of workbooks I know causes the closure. After saving and existing the workbook, then reopening (thus NOT having the userform alive), the unwanted closure does not happen. Period. Reactivate the userform show event, save, exit and re-open with the userform, and I can once again nearly consistently produce the crash.