programsam
Board Regular
- Joined
- Feb 10, 2016
- Messages
- 123
Alrighty folks, got another error on the following code. The code executes all the way down to the iframe coding.
I'm trying to fill out a webform that's nested in an IE frame and it's throwing a run time error when it gets to the With statement. Still learning so any assistance is much appreciated.
Here's what I have so far.
I'm trying to fill out a webform that's nested in an IE frame and it's throwing a run time error when it gets to the With statement. Still learning so any assistance is much appreciated.
Here's what I have so far.
Code:
Option Explicit
Sub fillForm()
'Establish IE
Dim IE As InternetExplorer
Set IE = New InternetExplorerMedium
'because of security settings, you must reset IE settings
'Change Settings
Dim activeLink As String
activeLink = "link"
'Open IE and Naviage to SAP form
With IE
.navigate activeLink
.Visible = True
'Loop to wait until page loads
Do While .Busy Or .readyState <> READYSTATE_COMPLETE
DoEvents
Loop
End With
'Find IE Form
Dim iframeDoc As MSHTML.HTMLDocument
Set iframeDoc = IE.document
'Fill out Form
Dim cT As String
cT = ThisWorkbook.Sheets("data").Range("P2").Value
With iframeDoc
iframeDoc.getElementById("contentAreaFrame").contentWindow.iframeDoc.getElementById("isolatedWorkArea").contentWindow.getElementById("__xmlview1--idInputCT-inner").Value = cT
'Submit Form
iframeDoc.getElementsById("__xmlview1--idFilterbar-btnGo").Value.Click
End With
'Call macro to pull results
End Sub