Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Dec 19, 2:56*pm, Frank wrote:
Hi Don: Thanks for your posting. I appreciate your help: Below is my test routine. Using Excel 2003, it fails and restart is required. Adding a resume next does not solve it either. The reason I use “table” instead “ifinance” is because a few years ago (2002 or so), “table” no longer worked. It apparently is now. Using non-adjusted versus adjusted-closing price: None of my programs use shares but if I were, I would still use non-adjusted prices and adjust the number of shares through time. Here is why: I’ve uploaded a picture of what CSCO looks like the first few days of trading back in 1990. From 3/26 to 4/11, Cisco lost 9.3% of its value but when using adjusting close, because of the two-decimal restriction, the share price was flat. Calculating volatility using adjusted prices is also misleading. The picture is athttp://www.gingins.info/csco.gif. Here is my test routine: Dim symbol As Range Dim strurl As String Sub atest() Application.ScreenUpdating = False ActiveSheet.UsedRange.Delete Range("A1") = "ibm" 'valid symbol Set symbol = Range("A1") strurl = "http://table.finance.yahoo.com/table.csv?s=" & symbol With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & strurl, Destination:=Range("A1")) * * .TextFileCommaDelimiter = True * * .TextFileColumnDataTypes = Array(4, 9, 9, 9, 1, 9, 9) * * .Refresh BackgroundQuery:=False End With ActiveSheet.UsedRange.Delete Range("A1") = "blablabla" 'invalid symbol Set symbol = Range("A1") strurl = "http://table.finance.yahoo.com/table.csv?s=" & symbol With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & strurl, Destination:=Range("A1")) * * .TextFileCommaDelimiter = True * * .TextFileColumnDataTypes = Array(4, 9, 9, 9, 1, 9, 9) * * .Refresh BackgroundQuery:=False End With ActiveSheet.UsedRange.Delete Range("A1") = "ge" 'valid symbol Set symbol = Range("A1") strurl = "http://table.finance.yahoo.com/table.csv?s=" & symbol With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & strurl, Destination:=Range("A1")) * * .TextFileCommaDelimiter = True * * .TextFileColumnDataTypes = Array(4, 9, 9, 9, 1, 9, 9) * * .Refresh BackgroundQuery:=False End With End Sub My suggestion was to not use text and not use the array. use as shown with text to columns. Send your email adddy to and I'll send you a free file that does this for as many symbols as desired, with graphs. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why do I have to restart Excel when ActiveSheet.QueryTables.Add fails? | Excel Programming | |||
ActiveSheet.QueryTables.Add | Excel Programming | |||
ActiveSheet.QueryTables.Add | Excel Programming | |||
ActiveSheet.QueryTables.Add | Excel Programming | |||
With ActiveSheet.QueryTables.Add | Excel Programming |