Hi,
I am new to VBA coding to access IE and fill the web form over Intranet.
I am trying to click a button HTML code below:
HTML-
<INPUT onclick='return btnAddNewLine_OnClick();WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$contentPH$btnAddLine", "", true, "", "", false, false))' id=ctl00_contentPH_btnAddLine title="Add a new line to this timesheet" class=button style="WIDTH: 135px" type=submit value="Add New Line" name=ctl00$contentPH$btnAddLine>
The below code gives me an error Run time error '91' (Object variable or with block variable not set).
Kindly help.
I am new to VBA coding to access IE and fill the web form over Intranet.
I am trying to click a button HTML code below:
HTML-
<INPUT onclick='return btnAddNewLine_OnClick();WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$contentPH$btnAddLine", "", true, "", "", false, false))' id=ctl00_contentPH_btnAddLine title="Add a new line to this timesheet" class=button style="WIDTH: 135px" type=submit value="Add New Line" name=ctl00$contentPH$btnAddLine>
The below code gives me an error Run time error '91' (Object variable or with block variable not set).
VBA Code:
[/B]
Sub Test ()
Dim appIE As Object
Dim sURL As String, infoStr As String
Set appIE = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")
sURL = "https://Timesheets/TimesheetHome.aspx"
With appIE
.Navigate sURL
.Visible = True
End With
Do While appIE.Busy Or appIE.ReadyState <> 4
DoEvents
Loop
appIE.document.all.Item("ctl00$contentPH$btnAddLine").Click
End Sub
[B]
Kindly help.