excelenergy
Board Regular
- Joined
- Jun 7, 2012
- Messages
- 142
Hello,
Im trying to pass some information to a webform, and my script works to open the page, and select a radio button, but after the radio button is selected, the script stops passing my data to the webform.
All my code is in place to do what I want....But yet the VBA Script isnt passing the data. And I think it has something to do with this statement:
Here is my full code, but it would probably be better if you downloaded my workbook here:
http://www.fileswap.com/dl/fM0ITxXDrZ/SEDI_Macro.xlsm.html
Full Code:
Im trying to pass some information to a webform, and my script works to open the page, and select a radio button, but after the radio button is selected, the script stops passing my data to the webform.
All my code is in place to do what I want....But yet the VBA Script isnt passing the data. And I think it has something to do with this statement:
Rich (BB code):
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
Here is my full code, but it would probably be better if you downloaded my workbook here:
http://www.fileswap.com/dl/fM0ITxXDrZ/SEDI_Macro.xlsm.html
Full Code:
Rich (BB code):
Option Explicit
Private Sub macro1()
' Set a reference to 'Microsoft Internet Controls' under the VBA Tools\References menu
Dim IE As InternetExplorer
Dim IO As InternetExplorer
Dim aa As Object 'HTMLInputElement
Dim ab As Object 'HTMLSelectElement
Dim ac As Object 'HTMLSelectElement
Dim ad As Object 'HTMLSelectElement
Dim ae As Object 'HTMLSelectElement
Dim af As Object 'HTMLSelectElement
Dim ag As Object 'HTMLSelectElement
Dim ah As Object 'HTMLSelectElement
Dim ai As Object 'HTMLSelectElement
Dim Button As Variant
Dim Form As Variant
Dim HTMLdoc As HTMLDocument
Set IE = New InternetExplorer
With IE
IE.navigate "https://www.sedi.ca/sedi/SVTReportsAccessController?menukey=15.03.00&locale=en_CA&gx_session=0"
IE.Visible = True
Do
DoEvents
Loop Until IE.readyState = 4
IE.document.all("ChosenReport").Item(0).Checked = True
'Select Units
'IE.Document.All("ChosenReport").Item(0).Checked = True
IE.document.forms(0).submit
End With
With IE
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
Set ab = .document.getElementByName("SELECT_TYPE")
ab.selectedIndex = 4
Set aa = .document.getElementByName("SELECT_TYPE_VALUE")
aa.Value = Range("B3")
Set ac = .document.getElementByName("SELECT_TYPE_VALUE_SEARCH_TYPE")
ac.Value = Range("C3")
Set ad = .document.getElementByName("DATE_RANGE_TYPE")
ad.selectedIndex = 0
Set ae = .document.getElementByName("MONTH_FROM_PUBLIC")
ae.Value = Range("D3")
Set af = .document.getElementByName("YEAR_FROM_PUBLIC")
af.Value = Range("F3")
Set ag = .document.getElementByName("MONTH_TO_PUBLIC")
ah.Value = Range("G3")
Set ah = .document.getElementByName("DAY_TO_PUBLIC")
ah.Value = Range("H3")
Set ai = .document.getElementByName("YEAR_TO_PUBLIC")
ai.Value = Range("I3")
Set Button = .document.getElementById("Submit")
Button.Click
End With
End Sub
Last edited: