LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Web Queries Truncated

Good Morning,

I have viewed many discussions relating to web queries from Yahoo
stock quotes but I have yet to find information on the following.
Is there a truncated code to perform the following function:

Sub Macro1()

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://table.finance.yahoo.com/d?a=7&b=27&c=2004&d=10&e=29&f=2004&g=d&s=nt.to"
_
, Destination:=Sheets("Sheet1").Range("A3"))
.Name = "d?a=7&b=27&c=2004&d=10&e=29&f=2004&g=d&s=nt.t o"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://table.finance.yahoo.com/d?a=7&b=27&c=2004&d=10&e=29&f=2004&g=d&s=zl.to"
_
, Destination:=Sheets("Sheet2").Range("A3"))
.Name = "d?a=7&b=27&c=2004&d=10&e=29&f=2004&g=d&s=zl.t o"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With

End Sub


I would like to perform this task to a list of stocks, however, I am
sure my coding is redundant. Is there a way to simplify the above to
state the connections such as:

1)
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://table.finance.yahoo.com/d?a=7&b=27&c=2004&d=10&e=29&f=2004&g=d&s=nt.to"
_
, Destination:=Sheets("Sheet1").Range("A3"))
.Name = "d?a=7&b=27&c=2004&d=10&e=29&f=2004&g=d&s=nt.t o"

2)
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://table.finance.yahoo.com/d?a=7&b=27&c=2004&d=10&e=29&f=2004&g=d&s=zl.to"
_
, Destination:=Sheets("Sheet2").Range("A3"))
.Name = "d?a=7&b=27&c=2004&d=10&e=29&f=2004&g=d&s=zl.t o"

And then the conditions to apply to all my queries:

.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False

This would really help condense the coding issues. Any help would be
greatly appreciated.

Sincerely,
Charles Kent
 
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
link truncated Stephen Rowe Links and Linking in Excel 0 January 22nd 07 01:31 AM
Hyperlinks are truncated [email protected] Excel Discussion (Misc queries) 0 May 12th 06 05:55 PM
GIF File Gets Truncated k2sarah Charts and Charting in Excel 1 December 2nd 05 05:29 AM
Printing truncated TUNGANA KURMA RAJU Excel Discussion (Misc queries) 1 November 26th 05 01:53 PM
Picture will be truncated CLR Excel Discussion (Misc queries) 0 June 3rd 05 02:44 PM


All times are GMT +1. The time now is 11:10 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"