Web query - unable to extract data

V

Vijay Kotian

Hi,

I have recorded a macro through which i would like to extract data from web
but unable to do so. Can someone help me.

With ActiveSheet.QueryTables.Add(Connection:= _

"URL;http://www.bseindia.com/mktlive/market_summ/categorywise_turnover.asp", _
Destination:=Range("A1"))
.Name = "categorywise_turnover"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "8"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With

Thank you.
 
N

Nigel

When you say recorded, you must have actually gone through the process to
extract data, did that work?
 
V

Vijay Kotian

I am not getting data, is there any way to get data from web directly to
excel with help of macro or any other mode.
 
O

oitbso

I am not getting data, is there any way to get data from web directly to
excel with help of macro or any other mode.





- Show quoted text -

Either of the following approaches pastes the web data into my
activesheet...Ron


Sub test1()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.bseindia.com/mktlive/market_summ/
categorywise_turnover.asp", _
Destination:=Range("A1"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub

------------------------------------------------------------------------------

Sub test2()
Set ie = CreateObject("InternetExplorer.Application")

With ie
.Visible = True
.Navigate "http://www.bseindia.com/mktlive/market_summ/
categorywise_turnover.asp"
.Top = 50
.Left = 530
.Height = 400
.Width = 400

' Loop until the page is fully loaded
Do Until Not .Busy
DoEvents
Loop

End With

' copy and paste
ie.ExecWB 17, 2
ie.ExecWB 12, 0
ActiveSheet.PasteSpecial Format:="Text", Link:=False,
DisplayAsIcon:=False
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top