0
Public Function GetProfileDetails(FormID As String,ControlName As String ,ProfileName As String)
    'Dim FormName As String: FormName = GetUserFormName(FormID)
    Dim ProfileRange As range: Set ProfileRange = range("DYUI_Profile")
    Dim TempRange As range: Set TempRange = Nothing
    Dim i As Integer: i = 0
    Dim ProfileColIndex As Integer: ProfileColIndex = getColumnIndex("Profile", ProfileRange)
    Dim UserNameColIndex As Integer: UserNameColIndex = getColumnIndex("UserName", ProfileRange)
    Dim PassowrdColindex As Integer: PassowrdColindex = getColumnIndex("Password", ProfileRange)
    Dim URLColIndex As Integer: URLColIndex = getColumnIndex("URL", ProfileRange)
    Dim RowCnt As Integer: RowCnt = ProfileRange.rows.Count

    For i = 2 To RowCnt
        If Trim(UCase(ProfileRange.rows.Cells(i, ProfileColIndex))) = Trim(UCase(ProfileName)) Then
            If TempRange Is Nothing Then
                Set TempRange = ProfileRange.rows(i)
            Else
                Set TempRange = Application.Union(TempRange, ProfileRange.rows(i))
            End If
        End If
    Next i

    For i = 1 To TempRange.rows.Count
        FormName.ControlName.Text = TempRange.rows.Cells(i, UserNameColIndex).Value
        FormName.ControlName.Text = TempRange.rows.Cells(i, PassowrdColindex).Value
        FormName.ControlName.Text = TempRange.rows.Cells(i, URLColIndex).Value
    Next i

    Worksheets("Form_Output").Cells(1, 3).Value = FormName.ControlName.Value
    Worksheets("Form_Output").Cells(1, 5).Value = FormName.ControlName.Value
    Worksheets("Form_Output").Cells(1, 7).Value = FormName.ControlName.Value   
End Function
4

1 回答 1

0

您不能像这样使用字符串形式或控件名称。传递您要使用的控制对象:

Public Function GetProfileDetails(TextBox As TextBox, ProfileName As String)
于 2013-10-28T07:28:12.610 回答