I run a series of queries in access and then export them to an excel file and name the worksheet. I have one worksheet that must contain a hyphen but when it exports it to excel the worksheet name has an underscore inserted instead of the name I entered. Does anyone know how to keep the hyphen from being converted to an underscore.
Offending code:
"NJ-AAA_Flag_Check" is converted to "NJ_AAA_Flag_Check"
Offending code:
VBA Code:
If DCount("sampname", "qry_test") Then
cnt = cnt + 1
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qry_test", "C:\Projects\Error Report\Report_working.xls", True, "NJ-AAA_Flag_Check"
End If
"NJ-AAA_Flag_Check" is converted to "NJ_AAA_Flag_Check"