Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Why do I have to restart Excel when ActiveSheet.QueryTables.Addfails? Options

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I have to restart Excel when ActiveSheet.QueryTables.Add fails? Frank[_28_] Excel Programming 1 November 23rd 10 04:19 PM
ActiveSheet.QueryTables.Add David Excel Programming 0 March 10th 08 10:39 PM
ActiveSheet.QueryTables.Add Rick Excel Programming 4 November 10th 05 04:24 AM
ActiveSheet.QueryTables.Add quartz[_2_] Excel Programming 0 November 9th 05 07:18 PM
With ActiveSheet.QueryTables.Add [email protected] Excel Programming 4 January 6th 04 04:58 PM


All times are GMT +1. The time now is 07:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"