talkvinith
06-25-2015, 12:18 AM
Hi all
Please Help!
I want to fetch a specific data from the webpage and get it pasted in B column of the excel sheet.
My source code is given below:
<span id = "LblAgentID_O"/Span>
If this code not found in the webpage then need to update in excel sheet as source not found.
To this macro it needs to get added.
Sub GetIE()
' This code is to get list of all open IE windows and there URLs
Dim sh As Object, oWin As Object, IE As Object
Set Shell = CreateObject("WScript.Shell")
Set sh = CreateObject("Shell.Application")
For Each oWin In sh.Windows
If TypeName(oWin.document) = "HTMLDocument" Then
Set IE = oWin
Exit For
End If
Next
MylastRow = Cells(Row.count,"A"). End(xlUp).Row
For I = 2 To MylastRow
If Sheet1.Cells(I, 1) <> "" Then ' Checking for non blank row
'below code is to enter file number on text
IE.document.getElementById("txtfino").Value = Sheet1.Cells(I, 1)
Application.Wait (Now + TimeValue("0:00:01")) 'wait time for 1 second
'below code is to click on
IE.document.getElementByname("btnGetQueue").Click
Application.Wait (Now + TimeValue("0:00:01")) 'wait time for 1 second
'here the fetching code needs to get added
Else
Exit For
End If
Next
Set shellWins = Nothing
Set IE = Nothing
End Sub
Please Help!
I want to fetch a specific data from the webpage and get it pasted in B column of the excel sheet.
My source code is given below:
<span id = "LblAgentID_O"/Span>
If this code not found in the webpage then need to update in excel sheet as source not found.
To this macro it needs to get added.
Sub GetIE()
' This code is to get list of all open IE windows and there URLs
Dim sh As Object, oWin As Object, IE As Object
Set Shell = CreateObject("WScript.Shell")
Set sh = CreateObject("Shell.Application")
For Each oWin In sh.Windows
If TypeName(oWin.document) = "HTMLDocument" Then
Set IE = oWin
Exit For
End If
Next
MylastRow = Cells(Row.count,"A"). End(xlUp).Row
For I = 2 To MylastRow
If Sheet1.Cells(I, 1) <> "" Then ' Checking for non blank row
'below code is to enter file number on text
IE.document.getElementById("txtfino").Value = Sheet1.Cells(I, 1)
Application.Wait (Now + TimeValue("0:00:01")) 'wait time for 1 second
'below code is to click on
IE.document.getElementByname("btnGetQueue").Click
Application.Wait (Now + TimeValue("0:00:01")) 'wait time for 1 second
'here the fetching code needs to get added
Else
Exit For
End If
Next
Set shellWins = Nothing
Set IE = Nothing
End Sub