hi,
i am using the below code to enter data into a web page
if i step through the code it works fine
if i run it it fails on
any ideas what can be causing it.
Once I get this it should save me about 5 mins per form, 15 forms per week so i would like to try and nail it if poss.
thanks
Hope this is of use, Rob.![[yoda] [yoda] [yoda]](/data/assets/smilies/yoda.gif)
i am using the below code to enter data into a web page
Code:
Public Sub CreateICEBRecord()
Dim rdate As Date
Dim rdesc As String
Dim rbenefit As String
Dim URL As String
Dim IE As Object
Dim f As Integer, e As Integer
URL = "[URL unfurl="true"]https://www.iceb.com/magicsiteltest/bin/Main.php?menu=request_fiche&_action=0"[/URL]
Set IE = CreateObject("InternetExplorer.Application")
rtitle = Range("b2").Value
ramount = Range("b3").Value
rcharge = Range("b4").Value
If rcharge = "Yes" Then
rcharge = 1
Else
rcharge = 2
End If
rlocation = Range("b6").Value
rdesc = Range("b7").Value
rbenefit = Range("b8").Value
With IE
.Visible = True
.Navigate URL
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
End With
With IE
.Document.Forms("AddReq").elements("_reqapp").Value = "25"
Call IE.Document.parentWindow.execScript("document.AddReq.submit();this.disabled=true;", "javascript")
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
.Document.Forms("savereq").elements("_reqtitle").Value = rtitle
.Document.Forms("savereq").elements("DF_37").selectedIndex = 1
.Document.Forms("savereq").elements("DF_37").onchange
.Document.Forms("savereq").elements("df_4").selectedIndex = "5"
.Document.Forms("savereq").elements("DF_5").Value = Round(ramount, 0)
.Document.Forms("savereq").elements("DF_3").selectedIndex = "1"
.Document.Forms("savereq").elements("DF_3").onchange
.Document.Forms("savereq").elements("df_48").Value = rcharge
.Document.Forms("savereq").elements("df_11").Value = Date
.Document.Forms("savereq").elements("DF_7").selectedIndex = 1
.Document.Forms("savereq").elements("DF_7").onchange
.Document.Forms("savereq").elements("df_49").selectedIndex = 5
.Document.Forms("savereq").elements("DF_24").selectedIndex = 54
.Document.Forms("savereq").elements("DF_24").onchange
.Document.Forms("savereq").elements("df_21").Value = 18
.Document.Forms("savereq").elements("newdesc").Value = rdesc
.Document.Forms("savereq").elements("reqbenefits").Value = rbenefit
End With
Set IE = Nothing
End Sub
if i run it it fails on
Code:
.Document.Forms("savereq").elements("DF_7").onchange
any ideas what can be causing it.
Once I get this it should save me about 5 mins per form, 15 forms per week so i would like to try and nail it if poss.
thanks
Hope this is of use, Rob.
![[yoda] [yoda] [yoda]](/data/assets/smilies/yoda.gif)