Sub importDatafromWEB()
On Error GoTo lb1:
'********************************************
' Add Library "Microsoft excel 10.0 object library"
'
'********************************************
' Add Library "Microsoft excel 10.0 object library"
'
'********************************************
Dim exl As Object
Dim wbk As Object
Dim sht As Object
Set exl = CreateObject("Excel.application")
Set wbk = exl.Workbooks.Add
Kill "C:\myfile.xls"
exl.ActiveWorkbook.SaveAs "C:\myfile.xls"
'exl.Visible = True
exl.Windows("myfile.xls").Activate
With exl.ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.x-rates.com/d/INR/table.html", Destination:=exl.Workbooks("myfile.xls").Sheets("Sheet1").Range("A1"))
"URL;http://www.x-rates.com/d/INR/table.html", Destination:=exl.Workbooks("myfile.xls").Sheets("Sheet1").Range("A1"))
.Name = "table"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "14"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
exl.ActiveWorkbook.Save
exl.ActiveWorkbook.Close Savechanges:=False
exl.Quit
Exit Sub
lb1:
MsgBox Err.Number & vbNewLine & Err.Description
End Sub
The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.