MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Getting Web page contents not working sometimes

  Asked By: Clifton    Date: Feb 07    Category: MS Office    Views: 670

I have created macro which gets contents of web site then writes to file,
sometimes its doesnt work as expected.

Sub Test()
Dim ie As Object

'Create an object to Internet Explorer
Set ie = CreateObject("InternetExplorer.Application")

path1 = "http://money.rediff.com/money/jsp/markets_home.jsp"

ie.Visible = False
ie.Navigate (path1)

'Wait till explorer navigate's to the page
While (ie.Busy = True)
'MsgBox ("Hello")
'All the text on the current window will be assigned to strdata variable
'strdata = ie.Document.getElementByID("mkt_top_index").innerText
'strdata = ie.Document.body.getElementsByTagName
strdata = ie.Document.getElementById
ActiveCell.FormulaR1C1 = strdata
ActiveWorkbook.SaveAs Filename:="C:\ExcelFile.txt", _
FileFormat:=xlText, CreateBackup:=False
'MsgBox (strdata)
End Sub



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Getting Web page contents not working sometimes Or get search suggestion and latest updates.