Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 10:00 AM
deko
Guest
 
Posts: n/a
Default Excel Automation question

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.


  #2  
Old November 13th, 2005, 10:00 AM
deko
Guest
 
Posts: n/a
Default 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.


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles