Hi All!!
I am working in MS Access 2007 and trying to create an TransferSpreadsheet export to a specific range in a file that already exists.
I have headers that I want to keep and I want to start the export in A3 of the specific worksheet.
I am getting a Run-time error '3125' '' is not a valid name.
Here is what I have currently. This is my entire Subroutine.
I have been trying to get this to work all morning with no luck.
Thanks for your help in advance!!
I am working in MS Access 2007 and trying to create an TransferSpreadsheet export to a specific range in a file that already exists.
I have headers that I want to keep and I want to start the export in A3 of the specific worksheet.
I am getting a Run-time error '3125' '' is not a valid name.
Here is what I have currently. This is my entire Subroutine.
Code:
Private Sub cmdCreateCMSFile_Click()
Dim strTemplate As String
Dim strOutFile As String
Dim strWorksheet As String
'copy template from the Q:\TSU\Template\ folder into the Q:\TSU\Output\
'as the file name of NEWFILE_X_yyyymmdd_hhmmss.xls
strTemplate = "Q:\TSU\Template\TemplateFile.xls"
strOutFile = "Q:\TSU\Output\NEWFILE_X_" & Format(Now(), "yyyymmdd_hhnnss") & ".xls"
'copy template to output file
FileCopy strTemplate, strOutFile
'turn warnings off
DoCmd.SetWarnings False
'copy X.I into the output file into the Timely Processing tab
strWorksheet = "Timely_Processing!A3"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qryX_I", strOutFile, False, strWorksheet
'turn warnings on
DoCmd.SetWarnings True
MsgBox "Process Completed"
End Sub
I have been trying to get this to work all morning with no luck.
Thanks for your help in advance!!