Connecting Tech Pros Worldwide Help | Site Map

Excel Automation question

deko
Guest
 
Posts: n/a
#1: Nov 13 '05
I need to insert a spreadsheet into an Excel workbook using SQL. If I use
this:

SELECT "JobName" As JobName, "LastTest" As LastTest , "Average" As Average ,
"StdDev" As StdDev INTO [Excel 8.0;Database=C:\Excel\JobFile].[Summary];

I get 2 rows in a new worksheet. I use the aliases so I don't get
"EXPR1000", "EXPR1001", etc. in the first row, which will be the header row.

How do I construct the SQL statement so I only end up with one row? I only
need the worksheet created and the header row inserted. I use other code
to populate the worksheet later.

Thanks in advance.


deko
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Excel Automation question


strSql = "SELECT " & _
Chr(34) & "" & Chr(34) & " As JobName, " & _
Chr(34) & "" & Chr(34) & " As LastTest , " & _
Chr(34) & "" & Chr(34) & " As Average , " & _
Chr(34) & "" & Chr(34) & " As StdDev INTO " & _
"[Excel 8.0;Database=" & strXlsPath & "].[Summary];"

not pretty, but it works.


Closed Thread


Similar Microsoft Access / VBA bytes