View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
RichardSchollar RichardSchollar is offline
external usenet poster
 
Posts: 196
Default Query text too long

Steve

Can you post your current code? I seem to remember that you can pass
longer SQL statements to a querytable object if you create the sql in
an array ie:

strSQL = Array("SELECT blah,blah, blah, blah")

Richard


steveh wrote:
I should have been more specific. I am querying an ODBC database and the
SQL query is too long.


John Bundy wrote:
There are a couple ways to do this if the first doesn't work but I use this
method, adapted from Microsoft.
Sub URL_Get_Query()

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;
http://www.moto-net.com/images/nouveautes2006/suzuki/bandit1200_static.jpg", _
Destination:=Range("a1"))

.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub