Exporting to Excel

Shane

Board Regular
Joined
Apr 8, 2002
Messages
51
When exporting a table directly to Excel from Access, it automatically defaults to file type Excel 95/97. How do I change this default to Excel 2000?

Thanks.
 
Howdy,

Marie Aiken said:
I'm trying to overwrite the previous Excel file with a new Excel file created by the Access query.

Try the following:

Code:
DoCmd.TransferSpreadsheet acExport, 8, "Your Query Name", "c:\temp\QryExport.xls"

Change the query name and filename/path strings.

This should export and overwrite without any notification. 8 gets you to:

acSpreadsheetTypeExcel9

which is the same as

acSpreadsheetTypeExcel8

Excel 2000 is version 9, whereas '97 is 8. Access 2000 doesn't care and uses the same output version for both.

Hope this helps and have a nice weekend.
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
This worked beautifully. When I was using "output to" in the Access it would not overwrite the Excel files. Now it overwrites existing Excel files and doesn't prompt me to replace them. Wonderful! This has been a great time saver for me. Thanks for your help!
 
Upvote 0
Mini-Thread Hijack with similar question

I have recently encountered a problem when exporting into a prepared xls using the TransferSpreadsheet command object within VBA. I've changed the layout of the destination xls such that I have five date format fields together. Usually, they are filled in left to right as events occur and the users are recording them, but frequently, only fields 1/2/5 are filled in as 3/4 are inapplicable to the specific situation.

Sometimes, when exporting, instead of the date value dropping into the 5th field, it "slides" to the left into the first unpopulated field (#3 usually)

The only suggestion I've found is to load the query I'm exporting into a recordset and parse it to the xls. The simple expedient of putting of pulling fields 3/4 out of order and placing them elsewhere on the sheet fixes the problem. Also, this does not happen in all possible cases.

The source data for the export is actually drawn from the same spreadsheet. I currently use the function, for example, to recreate the entire basic spreadsheet when rolling out changes to the base xls (which has some vba within it) or when something went wrong with xls formatting/layout and I want to simply start over.

I am highly suspicious that the issue is an xls field format problem. When I pull the data from the source xls during my import operation (actually an acLink), it's grabbing some property (null/empty/other) and setting the Access2K field properties in some fashion that when exporting (acExport) creates this problem.

While it's not a problem for me to write a function that can change only the properties needed to correct this, I have no idea what precisely is doing this. Can't fix it until I identify it.

Any ideas?

Mike
 
Upvote 0
oops

Mini clarification. My import is an acImport. Marginally relevant but what I'm actually using.

Just looking for hints.
 
Upvote 0
Re: oops

mdmilner said:
Mini clarification. My import is an acImport. Marginally relevant but what I'm actually using.

Just looking for hints.

This doesn't sound right... In any case, you might want to try something like:

http://www.mrexcel.com/board2/viewtopic.php?t=53716&start=4

This is from Excel, but if you want to work with Excel, try pulling from your spreadsheet instead of pushing from Access.
 
Upvote 0

Forum statistics

Threads
1,221,532
Messages
6,160,380
Members
451,643
Latest member
nachohoyu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top