petroj02
11-09-2016, 02:33 AM
Hello,
I am really confused about this one... At one userform I have Frame after click on this Frame i have some Action like hide original userform and Show new userform called properties.
At userfor with Name properties is query button with this code.
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
If MsgBox("If you press yes all progress will be lost. Do you really want to leave window?", vbQuestion + vbYesNo, "Exit") = vbNo Then
Cancel = True
Else
If Properties.Controls("Label22").Caption = "config_IM" Then
Unload Properties
config_IM.Show
ElseIf Properties.Controls("Label22").Caption = "Config" Then
Unload Properties
Config.Show
ElseIf Properties.Controls("Label22").Caption = "Config_RMG" Then
Unload Properties
Config_RMG.Show
ElseIf Properties.Controls("Label22").Caption = "Config_RMI" Then
Unload Properties
Config_RMI.Show
ElseIf Properties.Controls("Label22").Caption = "Config_UVP" Then
Unload Properties
Config_UVP.Show
ElseIf Properties.Controls("Label22").Caption = "Configurator" Then
Unload Properties
Configurator.Show
End If
End If
End If
End Sub
the Frame at original userform called config_IM I have this code...
Private Sub Frame1_Click()
Dim i As Integer
i = 24
If ThisWorkbook.Sheets("data_IM").Cells(i, 9) <> "" And ThisWorkbook.Sheets("data_IM").Cells(i, 9) <> "not exist" Then
Call setProperties("data_IM", i, "config_IM", "C4")
config_IM.Hide
Properties.Show
Else
MsgBox "LED is not fully defined, please choose LED color"
End If
End Sub
Show/hide Action works good when I press query button on properties for first time, but when I want to open again the userform properties by clicking on Frame it gives me error message, that userform properties is opened, it is true but just becouse it queryclose event ignores unload action
I have the part with last if condition at querryclose also at one command button, at it works good multiple times... Where is the Problem since for command button ist ok but for query it isnt?
I am really confused about this one... At one userform I have Frame after click on this Frame i have some Action like hide original userform and Show new userform called properties.
At userfor with Name properties is query button with this code.
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
If MsgBox("If you press yes all progress will be lost. Do you really want to leave window?", vbQuestion + vbYesNo, "Exit") = vbNo Then
Cancel = True
Else
If Properties.Controls("Label22").Caption = "config_IM" Then
Unload Properties
config_IM.Show
ElseIf Properties.Controls("Label22").Caption = "Config" Then
Unload Properties
Config.Show
ElseIf Properties.Controls("Label22").Caption = "Config_RMG" Then
Unload Properties
Config_RMG.Show
ElseIf Properties.Controls("Label22").Caption = "Config_RMI" Then
Unload Properties
Config_RMI.Show
ElseIf Properties.Controls("Label22").Caption = "Config_UVP" Then
Unload Properties
Config_UVP.Show
ElseIf Properties.Controls("Label22").Caption = "Configurator" Then
Unload Properties
Configurator.Show
End If
End If
End If
End Sub
the Frame at original userform called config_IM I have this code...
Private Sub Frame1_Click()
Dim i As Integer
i = 24
If ThisWorkbook.Sheets("data_IM").Cells(i, 9) <> "" And ThisWorkbook.Sheets("data_IM").Cells(i, 9) <> "not exist" Then
Call setProperties("data_IM", i, "config_IM", "C4")
config_IM.Hide
Properties.Show
Else
MsgBox "LED is not fully defined, please choose LED color"
End If
End Sub
Show/hide Action works good when I press query button on properties for first time, but when I want to open again the userform properties by clicking on Frame it gives me error message, that userform properties is opened, it is true but just becouse it queryclose event ignores unload action
I have the part with last if condition at querryclose also at one command button, at it works good multiple times... Where is the Problem since for command button ist ok but for query it isnt?