Exporting to a template in Excel

  • Thread starter Nicholas Scarpinato
  • Start date
N

Nicholas Scarpinato

I have various different export queries that are used to export various sets
of data (different vendors require different information for our products
that we're sending back to them) to Excel. The data exported to these sheets
is then copied to their respective generic template, based on the approriate
template for the vendor's data. What I'd like to do is skip the copy step and
allow the user to select the generic template, open it, export the data into
it, and save it with the filename being changed to "'Vendorname' - 'Today's
date'.xls". I've read some information about exporting ranges to Excel, but I
didn't understand it well enough to apply it to this process to test it.
 
J

Jeanette Cunningham

Nicholas,
the easiest way to understand it, is to set up some test exports using named
ranges and find out how it works.
To set up a named range in a worksheet, select the cells you want in the
range, then go Insert | Name | Define |
type in the name for your range, click OK.

Here is a sample. I set up a range called "Fridge" in a workbook called
RangeExport.xls
To export to this range with transfer spreadsheet use code like this:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qryExportRange", _
"C:\Documents and Settings\jeanette\Desktop\RangeExport.xls", ,
"Fridge"

Jeanette Cunningham
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top