diff --git a/VBA/Forms/frmAddSpec.frm b/VBA/Forms/frmAddSpec.frm index 31b9bce..0a8d4c1 100644 --- a/VBA/Forms/frmAddSpec.frm +++ b/VBA/Forms/frmAddSpec.frm @@ -47,6 +47,30 @@ Private Sub UserForm_Initialize() .ListStyle = fmListStyleOption End With + ' 初始化参数名称下拉框 (新增) + With Me.cboParamName + .Clear + If Not mParamWorksheet Is Nothing Then + Dim paramLastRow As Long + Dim j As Long + Dim paramStr As String + + ' 表头在第2行,数据在C列,实际数据从第3行开始 + paramLastRow = mParamWorksheet.Cells(mParamWorksheet.Rows.count, "C").End(xlUp).row + If paramLastRow >= 3 Then + For j = 3 To paramLastRow + paramStr = Trim(mParamWorksheet.Cells(j, 3).value) + If paramStr <> "" Then + .AddItem paramStr + End If + Next j + + ' 将数据中的第一个数据作为默认数据 + If .ListCount > 0 Then .ListIndex = 0 + End If + End If + End With + ' 初始化预览文本框 On Error Resume Next Me.txtConditionPreview.Text = "" @@ -228,7 +252,7 @@ End Sub Private Sub btnExecute_Click() ' --- 校验输入 --- Dim paramName As String, newValue As String, strategy As String - paramName = Trim(Me.txtParamName.Text) + paramName = Trim(Me.cboParamName.Text) newValue = Trim(Me.txtNewValue.Text) strategy = Me.cboStrategy.value