the following code creates the file as expected when run within the module.
how can this be inserted as a step within a macro, I tried RUNCODE to no avail.
Public Function NRP_Extract()
Dim Cmonth As String
Dim Cday As String
Dim DATENOW As String
Dim FileName As String
If Month(Now()) < 10 Then
Cmonth = "0" & Month(Now())
Else
Cmonth = Month(Now())
End If
If Day(Now()) < 10 Then
Cday = "0" & Day(Now())
Else
Cday = Day(Now())
End If
DATENOW = Year(Now()) & Cmonth & Cday
FileName = "L:\West Chester\Supply Chain Management" & DATENOW & "NRP_Master_Data_Extract.xlsx"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "q_NRP_Master_Data_Extract", FileName, True, ""
End Function