Tom_wbi
asked on
Access 2007 - Exporting TAble Contents to Excel 2007 Spreadsheet
Hi All,
I have seen this question posed all over online and yet none of the answers that seems to work for others actually works for me! What I am trying to do is EXPORT the contents of an Acees 2007 Table to an Excel 2007 spreadsheet in XSLX format.
I have tried:
DoCmd.TransferText acExport, acSpreadsheetTypeExcel12Xm l, "JournalRequest", "H:\WBC\Projects-in-Progre ss\Trade Preparation Database Tool\JournalRequest.xslx", True
and
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xm l, "JournalRequest", "H:\WBC\Projects-in-Progre ss\Trade Preparation Database Tool\JournalRequest.xslx", True
As you can see my Table Name is "JournalRequest" and I have hard-coded the path to the Output File I want to create.
I CAN achieve outputting my data to other Text Files (CSV, TXT) formats using Export Specifications I create. BUT I *think* that there HAS to be a way to do what I'm attemption. Help!
I have seen this question posed all over online and yet none of the answers that seems to work for others actually works for me! What I am trying to do is EXPORT the contents of an Acees 2007 Table to an Excel 2007 spreadsheet in XSLX format.
I have tried:
DoCmd.TransferText acExport, acSpreadsheetTypeExcel12Xm
and
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xm
As you can see my Table Name is "JournalRequest" and I have hard-coded the path to the Output File I want to create.
I CAN achieve outputting my data to other Text Files (CSV, TXT) formats using Export Specifications I create. BUT I *think* that there HAS to be a way to do what I'm attemption. Help!
so, what is the problem?
do you mean, using a variable as the name of the .xlsx file?
dim strTable
strTable="JournalRequest"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xm l, strTable, "H:\WBC\Projects-in-Progre ss\Trade Preparation Database Tool\" & strTable & ".xslx", True
dim strTable
strTable="JournalRequest"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xm
You spelled the extension wrong
.xlsx
.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi All - No I mean it does not work.
For example, using:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xm l, "JournalRequest", "H:\WBC\Projects-in-Progre ss\Trade Preparation Database Tool\JournalRequest.xslx", True
Generates Run-time Error 3027. 'Cannot Update. Database or object is read-only'
When I modify the command as such:
DoCmd.TransferText acExport, acSpreadsheetTypeExcel12Xm l, "JournalRequest", "H:\WBC\Projects-in-Progre ss\Trade Preparation Database Tool\JournalRequest.xslx", True
The error becomes: 'You cannot import this file' even though I'm trying to do an EXPORT.
So, I must have some syntax wrong with my command - perhaps a bad constant??
Sorry I wasn't more clear, initially.
For example, using:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xm
Generates Run-time Error 3027. 'Cannot Update. Database or object is read-only'
When I modify the command as such:
DoCmd.TransferText acExport, acSpreadsheetTypeExcel12Xm
The error becomes: 'You cannot import this file' even though I'm trying to do an EXPORT.
So, I must have some syntax wrong with my command - perhaps a bad constant??
Sorry I wasn't more clear, initially.
the .xslx is wrong (.xlsx) as pointed out by jeff, unless it is just a typo error
ASKER
OMG!!!
I am partially dyslexic and could NOT see that I was transposing the 'l' and 's'. Thank you so much for taking the time to notice this!!!!!!
I am partially dyslexic and could NOT see that I was transposing the 'l' and 's'. Thank you so much for taking the time to notice this!!!!!!
1. First you are never stating what actually happens when it "Does not work"
Nothing happens?
Wrong output format?
Access Crashes?
Error message?
You will get some type of read only error, and the Export will "Not Work" when you spell the extension incorrectly as you have done in the code you posted.
Please correct this misspelling and tell us if that fixes this issue.
JeffCoachman
Nothing happens?
Wrong output format?
Access Crashes?
Error message?
You will get some type of read only error, and the Export will "Not Work" when you spell the extension incorrectly as you have done in the code you posted.
Please correct this misspelling and tell us if that fixes this issue.
JeffCoachman
Thanks...
It is a common mistake.
;-)
Jeff
It is a common mistake.
;-)
Jeff