Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Question

Status
Not open for further replies.

Huey462

Technical User
Jun 30, 2010
18
US
I have a saved import and export, created using the wizard that allows me to save the backup information as an Excel 2007 file. I cannot, however, determine how to do this with VBA using the “docmd.TransferSpreadsheet”

I tried the following, but the resulting file cannot be opened
Code:
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Master", "C:\CA-CRL Access\CA-CRL Database", True
I had tried dropping of the "Xml" from the acSpreadsheet, but that resulted in a binary Excel file. While this does work for the purposes of backing up the data, using the built in export keeps the formatting which, in my opinion, makes it look more professional and polished.

Thanks in advance
-Huey
 
See this thread
thread702-1611450

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
Works like a champ, my only other question is if it is possible to keep the formatting like the saved export does?

Code:
'Defines variables
    Dim FPath As String
    Dim FName As String
    FPath = "C:\Junk\"
    FName = "Testbackup.XLSX"
    DoCmd.TransferSpreadsheet acExport, 10, "Master", FPath & FName, Yes, , False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top