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
嗨博南......它是在窗體名稱一樣無效預選賽... –
給錯誤@ milan.s替換所有'FormName.ControlName.'用'文本框.'。 – Boann
但我動態生成表單,所以我需要用戶名錶單或引用來引用表單的控制... –