Jeffin
03-19-2015, 12:35 PM
Hello,
I am using the DoCmd.TransferSpreadsheet method to export some queries into an excel workbook.
My issue is simple but I can't seem find a valid solution online, other than renaming my queries.
Anyways, the queries I'm trying export have spaces in them, and the end user wants the worksheets to be named exactly the same as the queries, with the spaces; however, this is not translating correctly to the worksheet names.
Example:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "11 - Rates - Ocean", _
Application.CurrentProject.Path & "\IL Rate Workbook.xlsx", True, "11 - Rates - Ocean"
The query "11 - Rates - Ocean" is resulting in a worksheet name of "_11___Rates___Ocean".
I understand that the spaces are causing all the underscores, but why is there a spontaneous underscore in front of the 11 too? Anyways, are there any possible solutions for this issue besides renaming all my queries???
Note: I've also tried putting single quotations in the double quotations like the following: "'11 - Rates - Ocean'".
Thank you for all the comments and advice in advanced.
Best Regards,
- Jeffin
I am using the DoCmd.TransferSpreadsheet method to export some queries into an excel workbook.
My issue is simple but I can't seem find a valid solution online, other than renaming my queries.
Anyways, the queries I'm trying export have spaces in them, and the end user wants the worksheets to be named exactly the same as the queries, with the spaces; however, this is not translating correctly to the worksheet names.
Example:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "11 - Rates - Ocean", _
Application.CurrentProject.Path & "\IL Rate Workbook.xlsx", True, "11 - Rates - Ocean"
The query "11 - Rates - Ocean" is resulting in a worksheet name of "_11___Rates___Ocean".
I understand that the spaces are causing all the underscores, but why is there a spontaneous underscore in front of the 11 too? Anyways, are there any possible solutions for this issue besides renaming all my queries???
Note: I've also tried putting single quotations in the double quotations like the following: "'11 - Rates - Ocean'".
Thank you for all the comments and advice in advanced.
Best Regards,
- Jeffin