Thread: Excel Query
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] PhaseDragon@cox.net is offline
external usenet poster
 
Posts: 8
Default Excel Query

This is what Excel records when I record the Query as a macro using the Query
Wizard of Excel 2003:

With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=Excel Files;DBQ=D:\Research
4851.xls;DefaultDir=D:;DriverId=790;MaxBufferSize= 2048;PageTimeout=5;" _
, Destination:=Range("N2"))
.CommandText = Array( _
"SELECT `Discover$`.`#`, `Discover$`.`Tech Name`" & Chr(13) & "" &
Chr(10) & "FROM `D:\Research 4851`.`Discover$` `Discover$`" & Chr(13) & "" &
Chr(10) & "ORDER BY `Discover$`.`#`, `Discover$`.`Tech Name`" _
)
.Name = "Query from Excel Files_7"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = True
.PreserveFormatting = True
.RefreshOnFileOpen = True
.BackgroundQuery = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With