I tried again to record the macro and it now runs without the error message.
I am not sure
what I did differently.
Here's the revised Macro:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 17/11/2003 by Bob
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;
http://www.tse.ca/HttpController?GetPage=QuotesViewPage&DetailedView=De
tailedPrices&Language=en&QuoteSymbol_1=bce&x=18&y=7" _
, Destination:=Range("A1"))
.Name = _
"HttpController?GetPage=QuotesViewPage&DetailedView=DetailedPrices&Language=
en&QuoteSymbol_1=bce&x=18&y=7"
.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 = "28"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Is there a way to modify the following SUB to just parse the LAST TRADE and
END OF DAY DATA tables for the
Last Traded Rolling 52Week High Rolling Week Low P/E Ratio
Earnings/Share Indicated dividend rate
values?
Sub tse()
Application.ScreenUpdating = False
Start = Timer
' Dim rng As Range
' Set rng = Range("B3:H12")
' rng.Delete
Set wbk1 = ThisWorkbook
Worksheets(1).EnableCalculation = False
With wbk1.Sheets(1)
LastColumn = .Cells(1, 2).End(xlToRight).Column
LastRow = .Cells(2, 1).End(xlDown).Row
End With
For i = 3 To LastRow
sURL = ""
Symbol = Cells(i, 1)
' sURL = "
http://finance.yahoo.com/q?s=" & Symbol
sURL =
"
http://www.tse.ca/HttpController?GetPage=QuotesViewPage&DetailedView=Detail
edPrices&Language=en&QuoteSymbol_1="
sURL = sURL & Symbol & "&x=11&y=8"
Workbooks.Open sURL
Set wbk2 = ActiveWorkbook
With wbk2.Sheets(1)
.Columns("A:R").EntireColumn.Delete
.Rows("1:56").EntireRow.Delete
.Cells.ClearFormats
.Cells(1, 1).Select
.Columns.ColumnWidth = 10
.Rows.RowHeight = 12
End With
' Columns("A:R").Select
' Selection.Delete Shift:=xlToLeft
' Rows(1:59).Select
' Selection.Delete Shift:=xlUp
For j = 2 To LastColumn
SEARCHKEY = wbk1.Sheets(1).Cells(2, j)
Cells.Find (SEARCHKEY)
wbk1.Sheets(1).Cells(i, j) _
= wbk2.Sheets(1).Cells.Find _
(SEARCHKEY).Offset(0, 1)
Next j
wbk2.Close SaveChanges:=False
Next i
endtime = Timer
MsgBox (endtime - Start) / 60
Application.ScreenUpdating = False
End Sub
We're getting there. Thanks for the help.
Regards, Bob