Are you able to create a header record when exporting a query into a spreadsheet? Thank you in advance!!
Are you able to create a header record when exporting a query into a spreadsheet? Thank you in advance!!
How are you doing the export? The export wizard will take the table/query fields as the header row for the spreadsheet.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Using this VBA code,
DoCmd.TransferSpreadsheet acExport, 8, "qryExportMSR", "c:\production\QOH-Title.xls", True, ""
The True argument tells the code to send the field names as the first row. Is that not working?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Yes, the field names are working properly. I'm trying to place a report title and date of printing before the field names and data. That's why I was checking to see if their is a way to create a header for the spreadsheet.
Not with the wizard or TransferSpreadsheet methods. You could have additional VBA code to modify the spreadsheet once it is created to insert rows and text into cells.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
OK. could you point me in that direction?
First declare workbook and worksheet objects then insert rows and insert values to cells. Start with:
http://www.java2s.com/Code/VBA-Excel...ctvariable.htm
http://www.anthony-vba.kefra.com/vba/vbabasic2.htm
http://bytes.com/topic/access/answer...ccess-using-vb
Attempt code and post for analysis if you have issue.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks. I'll look at these links tonight.