That is pretty neat, I was able to do the Get Fields, But having trouble with the set fields, It is debugging on me.
Specifically in 3 places:
#1 Set objInputElement = objParent.Tags("INPUT").Item(ActiveSheet.Cells(lngRow,
cElement_Name).Text)
#2
objParent.Item(ActiveSheet.Cells(lngRow, cElement_Name).Text).Value = CStr(ActiveSheet.Cells(lngRow,
cElement_SetValue))
#3
ActiveSheet.Cells(lngRow, cElement_SetValue)
The whole code is below:
Im still relatively new to VBA and especially getting the programs to interact with one another. I do okay with keeping and working with the data in the same application.. This is like learning a new language, That is not in my dictionary just yet.
The Get fields worked great. Am I supposed to put the text that I want to upload on column IV in Excel in the appropriate row that the get field application supplied.
Just a little confused what to do.
Above the code in that thread you gave me it says this:
"2 SetFields(): Takes the above listing and pushes data back to the web page
using the last column in the worksheet."
Thanks for posting this, I appreciate it.
Sub SetFields()
On Error Resume Next
Dim objIE As Object
Dim objParent As Object
Dim objInputElement As Object
Dim lngRow As Long
Set objIE = GetIEApp
'Make sure an IE object was hooked
If TypeName(objIE) = "Nothing" Then
MsgBox "Could not hook Internet Explorer object", vbCritical, "GetFields() Error"
GoTo Clean_Up
End If
For lngRow = 2 To ActiveSheet.UsedRange.Rows.Count
If ActiveSheet.Cells(lngRow, cElement_SetValue) <> "" Then
'If we have a parent name/ID drill to that element, otherwise point to whole document
If ActiveSheet.Cells(lngRow, cForm_name).Text <> "" Then
Set objParent = objIE.Document.Forms(ActiveSheet.Cells(lngRow, cForm_name).Text)
ElseIf ActiveSheet.Cells(lngRow, cForm_Id).Text <> "" Then
Set objParent = objIE.Document.Forms(ActiveSheet.Cells(lngRow, cForm_Id).Text)
Else
Set objParent = objIE.Document.All
End If
With objParent
If ActiveSheet.Cells(lngRow, cElement_Type) = "radio" Then
Set objInputElement = objParent.Tags("INPUT").Item(ActiveSheet.Cells(lngRow,
cElement_Name).Text)
objInputElement.Item(ActiveSheet.Cells(lngRow, cElement_ID).Text).Checked = True
Set objInputElement = Nothing
ElseIf ActiveSheet.Cells(lngRow, cElement_Type) = "checkbox" Then
objParent.Item(ActiveSheet.Cells(lngRow, cElement_ID).Text).Checked = True
Else
objParent.Item(ActiveSheet.Cells(lngRow, cElement_Name).Text).Value = CStr(ActiveSheet.Cells(lngRow,
cElement_SetValue))
End If
End With
If Err.Number <> 0 Then
Debug.Print "Error Writting: Row " & lngRow, ActiveSheet.Cells(lngRow, cElement_Name),
ActiveSheet.Cells(lngRow, cElement_SetValue)
Err.Clear
End If
End If
Next lngRow
Clean_Up:
Set objParent = Nothing
Set objIE = Nothing
End Sub