Hello,
I'm hoping to get help with the following challenge (man - I appreciate this forum!)
I will provide the user's sequential steps, problem statement, hypothesis, and then the code.
Usability Steps:
1. User opens .xlsm file (there are about 15 users in which each has their own unique copy; the only difference between each copy is the filename)
2. A Userform (named Userform2) opens once the file opens.
3. Userform2 has two control buttons: (a) first control button opens a userform called Userform1; and (b) the second control button opens a different userform called Userform3
4. Once the user clicks either control button a Msgbox to receive a password appears and if the user correctly enters the password, the respective userform opens (either Userform1 or Userform3) and Userform2 closes.
Problem Statement: In a limited set of users, Excel will crash when the user selects either control button or after the user enters the password and selects "OK". Excel will provide the following message:
(1) Microsoft has stopped working...; then (2) Excel offers an option to check online for a solution and then shuts down (no solution is provided).
Hypothesis: A conflict occurs in which one Userform is attempting to close while another Userform is attempting to open.
Code:
A. The following code is used under Microsoft Excel Objects > This Workbook (this code launches Userform2)
Private Sub Workbook_Open()
Application.WindowState = xlMaximized
ActiveSheet.Protect , UserInterfaceOnly:=True
UserForm2.Show vbModeless
End Sub
B. The following code is used under Forms > UserForm2 (this code checks the password and if correct, opens the respective userform)
Private Sub fmcobu1accountmanager_Click()
Dim Res As String
Const PWORD As String = "XXXXXX"
Res = InputBox(Prompt:="Enter password")
If Res <> PWORD Then
MsgBox Prompt:="The password has not " _
& "been recognized!", _
Buttons:=vbCritical, _
Title:="Password"
Exit Sub
End If
Unload UserForm2
ThisWorkbook.Save 'Without this line Excel crashes for all users
UserForm1.Show
End Sub
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub fmcobu2fae_Click()
Dim Res As String
Const PWORD As String = "YYYYYYY"
Res = InputBox(Prompt:="Enter password")
If Res <> PWORD Then
MsgBox Prompt:="The password has not " _
& "been recognized!", _
Buttons:=vbCritical, _
Title:="Password"
Exit Sub
End If
Unload UserForm2
ThisWorkbook.Save 'Without this line Excel crashes for all users
UserForm3.Show
End Sub
Please help and THANK YOU!!!
DC
I'm hoping to get help with the following challenge (man - I appreciate this forum!)
I will provide the user's sequential steps, problem statement, hypothesis, and then the code.
Usability Steps:
1. User opens .xlsm file (there are about 15 users in which each has their own unique copy; the only difference between each copy is the filename)
2. A Userform (named Userform2) opens once the file opens.
3. Userform2 has two control buttons: (a) first control button opens a userform called Userform1; and (b) the second control button opens a different userform called Userform3
4. Once the user clicks either control button a Msgbox to receive a password appears and if the user correctly enters the password, the respective userform opens (either Userform1 or Userform3) and Userform2 closes.
Problem Statement: In a limited set of users, Excel will crash when the user selects either control button or after the user enters the password and selects "OK". Excel will provide the following message:
(1) Microsoft has stopped working...; then (2) Excel offers an option to check online for a solution and then shuts down (no solution is provided).
Hypothesis: A conflict occurs in which one Userform is attempting to close while another Userform is attempting to open.
Code:
A. The following code is used under Microsoft Excel Objects > This Workbook (this code launches Userform2)
Private Sub Workbook_Open()
Application.WindowState = xlMaximized
ActiveSheet.Protect , UserInterfaceOnly:=True
UserForm2.Show vbModeless
End Sub
B. The following code is used under Forms > UserForm2 (this code checks the password and if correct, opens the respective userform)
Private Sub fmcobu1accountmanager_Click()
Dim Res As String
Const PWORD As String = "XXXXXX"
Res = InputBox(Prompt:="Enter password")
If Res <> PWORD Then
MsgBox Prompt:="The password has not " _
& "been recognized!", _
Buttons:=vbCritical, _
Title:="Password"
Exit Sub
End If
Unload UserForm2
ThisWorkbook.Save 'Without this line Excel crashes for all users
UserForm1.Show
End Sub
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub fmcobu2fae_Click()
Dim Res As String
Const PWORD As String = "YYYYYYY"
Res = InputBox(Prompt:="Enter password")
If Res <> PWORD Then
MsgBox Prompt:="The password has not " _
& "been recognized!", _
Buttons:=vbCritical, _
Title:="Password"
Exit Sub
End If
Unload UserForm2
ThisWorkbook.Save 'Without this line Excel crashes for all users
UserForm3.Show
End Sub
Please help and THANK YOU!!!
DC