У меня есть пользовательская форма с несколькими командными кнопками на ней с уникальными надписями на каждой кнопке.Я намерен использовать заголовок в качестве переменной в коде в модуле.
1-я кнопка (commandbutton13) нажала работает нормально.Но когда я нажимаю 2-ю кнопку (commandbutton14), она все еще сохраняет заголовок с 1-й кнопки (commandbutton13) в качестве переменной.
Private Sub CommandButton13_Click() 'PRIC Button userform
HoldType = UF_Dashboard.CommandButton13.Caption 'caption is PRIC
HoldText = UF_Dashboard.TextBox5.Value
sCell = UF_Dashboard.TextBox4.Value
'Check for sales order and hold text
If TextBox4.Text = "" Or TextBox5.Text = "" Then
MsgBox ("You must enter a Sales Order and Hold Text to continue.")
Exit Sub
End If
Hold
End Sub
Private Sub CommandButton14_Click() 'CUST Button on userform
HoldType = UF_Dashboard.CommandButton14.Caption 'caption is CUST
HoldText = UF_Dashboard.TextBox5.Value
sCell = UF_Dashboard.TextBox4.Value
'Check for sales order and hold text
If TextBox4.Text = "" Or TextBox5.Text = "" Then
MsgBox ("You must enter a Sales Order and Hold Text to continue.")
Exit Sub
End If
Hold
End Sub
Внутри модуля у меня есть следующее:
Public HoldType as String
Мне нужна помощь, чтобы понять, почему HoldType отображается как PRIC после нажатия кнопки command14.Даже в режиме разработчика я не могу выбрать строку, поэтому я предполагаю, что она фиксируется в первом определении HoldType в коде commandbutton13.