Samadhan Gaikwad
Member
Code:
Option Explicit
Sub SaveHTml()
Dim str1, str2, str3, str4, str5, str6, str7, URL As String
Dim ie, frm As Object
Dim i As Long
Dim filename As String
Dim FF As Integer
'Dim elems As IHTMLInputTextElement
Dim wb As WebBrowser
Dim objElement As Object
Dim objCollection As Object
Dim Button As Object
'On Error Resume Next
Application.ScreenUpdating = False
str1 = Sheets("PR_data_with_search").Range("F10").Value
str2 = Sheets("PR_data_with_search").Range("I10").Value
URL = "https://webtac.industrysoftware.automation.com/webpr/webpr.php?objtype=frames" 'for TEST
filename = "C:\Users\" & Environ("UserName") & "\Desktop\Test.htm"
Set ie = CreateObject("Internetexplorer.Application")
ie.Visible = True
ie.Navigate URL
Do Until ie.ReadyState = 4
DoEvents
Loop
Set ie = Nothing
' load next web page
Dim i1 As Integer
Dim txt, p As String, link As String
txt = "Advanced Search"
Do Until link = txt
i1 = i1 + 1
p = ie.Document.Links(i1).tostring
link = Right(p, 6)
Loop
ie.Document.Links(i).Click
ie.Document.getelementsbyname("openedFrom_dateText")(0).Value = str1
ie.Document.getelementsbyname("openedTo_dateText")(0).Value = str2
'Call ie.Document.getElementsByTagName("ok").Item(1).Click
Set Button = ie.Document.getElementById("ok")
Button.Click
Do
Loop While ie.Busy
CreateObject("Scripting.FileSystemObject").CreateTextFile filename
Do Until ie.ReadyState = 4
DoEvents
Loop
FF = FreeFile
Open filename For Output As #FF
With ie.Document.body
Print #FF, .outerHTML & .innerHTML
End With
Close #FF
ie.Quit
Set ie = Nothing
Application.ScreenUpdating = True
End Sub
I can load web page with URL - https://webtac.industrysoftware.automation.com/webpr/webpr.php?objtype=frames
but unable to navigate to next page by clicking on hyperlink having text "Advanced Search".
here is the html code for link:
Code:
<li><a href="javascript:parent.gotoSearch('advanced')">Advanced Search</a></li>
Code:
<input type=button name="ok" id="ok" value=" OK " onClick="onSubmitFunction()">
Last edited: