export table to excel (1 Viewer)

focus10

Registered User.
Local time
Today, 02:52
Joined
Mar 8, 2009
Messages
38
after the last microsoft update access 2003 fail to export to excel 2010
by DoCmd.TransferSpreadsheet

is anybody has a solution?

thanks
 

isladogs

MVP / VIP
Local time
Today, 02:52
Joined
Jan 14, 2017
Messages
18,216
You are probably going to have issues trying to export from an old version of Access to a newer version of Excel

However you could try changing the spreadsheet type in the code from acSpreadsheetTypeExcel9 (or similar) to acSpreadsheetTypeExcel12 (for Excel 2007 or later)

Syntax something like:
Code:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, TableName, ExcelFile, True, Range
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:52
Joined
May 7, 2009
Messages
19,231
I don't think the enum constant is available in a2003?
 

isladogs

MVP / VIP
Local time
Today, 02:52
Joined
Jan 14, 2017
Messages
18,216
I no longer use A2003 but this is the help file info taken from A2010:



Note that 10 years on, the help file still doesn't include the newer Excel file types:
- acSpreadsheetTypeExcel12 / acSpreadsheetTypeExcel12xml
 

Attachments

  • Capture.PNG
    Capture.PNG
    33.6 KB · Views: 360

focus10

Registered User.
Local time
Today, 02:52
Joined
Mar 8, 2009
Messages
38
acSpreadsheetTypeExcel12 is not recognized by access 2003

must be some where another solution
 

isladogs

MVP / VIP
Local time
Today, 02:52
Joined
Jan 14, 2017
Messages
18,216
That really doesn't surprise me as its for the later version.

You are always going to get problems like this when you mix up Office versions

However, it should still work with the older version designed for Excel 2000-2003:

Code:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, TableName, ExcelFile, True, Range
 

Mark_

Longboard on the internet
Local time
Yesterday, 18:52
Joined
Sep 12, 2017
Messages
2,111
Focus10,

Can you export to a CSV then open said CSV in excel? The DoCmd.TransferText method may offer another route to achieve the same results.

This should avoid version issues with different users having different versions of excel. Also affords the ability to import into earlier versions, should one still have one.
 

focus10

Registered User.
Local time
Today, 02:52
Joined
Mar 8, 2009
Messages
38
acSpreadsheetTypeExcel9 did the job until the last update by microsoft.
after the last update we are in a new era with a new problem.
 

focus10

Registered User.
Local time
Today, 02:52
Joined
Mar 8, 2009
Messages
38
csv can be a good solution for self using.
but not enough when customers are involved

thanks for the answer
 

Users who are viewing this thread

Top Bottom