R
ragtopcaddy via AccessMonster.com
I have a problem exporting via transferspreadsheet. Here's my code:
'Get the query used in the TransferSpreadsheet command
Set qdf = dbLocal.QueryDefs("qryMktStudyRpt")
'Update the query's sql to the new sql
qdf.SQL = strSQL
RngName = shtName & "!" & RngName
'Transfer the data to the named range
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryMktStudyRpt",
strRptPath, False, RngName
shtName is "Denver_ATS" and has no spaces. RngName is "DenverATS" and has no
spaces.
I get the following error msg on the export command:
Run-time error '3125':
'Denver_ATS$DenverATS' is not a valid name...etc.
As you can see, the VBE has taken the liberty of substituting a "$" For my "!
". How do I deal with this? The workbook will end up with several worksheets
and named ranges in the same format.
Thanks,
'Get the query used in the TransferSpreadsheet command
Set qdf = dbLocal.QueryDefs("qryMktStudyRpt")
'Update the query's sql to the new sql
qdf.SQL = strSQL
RngName = shtName & "!" & RngName
'Transfer the data to the named range
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryMktStudyRpt",
strRptPath, False, RngName
shtName is "Denver_ATS" and has no spaces. RngName is "DenverATS" and has no
spaces.
I get the following error msg on the export command:
Run-time error '3125':
'Denver_ATS$DenverATS' is not a valid name...etc.
As you can see, the VBE has taken the liberty of substituting a "$" For my "!
". How do I deal with this? The workbook will end up with several worksheets
and named ranges in the same format.
Thanks,