Hi can anyone explain to me why when I open a template(xltm)
the below code when actioned on change does want to run as it halts at with a file type Extension issue
ie .SaveAs "P:\Archives" & Dname with a message stating :
This extension can not be used with the selected file type, change the file extension in the filename to a different file type by choosing save as.
If any one knows a work around or suggestion can they please post as I need to save the file with the macros included for obvious reasons. many thanks in advance
the below code when actioned on change does want to run as it halts at with a file type Extension issue
ie .SaveAs "P:\Archives" & Dname with a message stating :
This extension can not be used with the selected file type, change the file extension in the filename to a different file type by choosing save as.
If any one knows a work around or suggestion can they please post as I need to save the file with the macros included for obvious reasons. many thanks in advance
Code:
If Sh Is Nothing Then
If Target.Column = 12 Or Target.Column = 15 Then ' 3'rd and 4th columns are active
Dname = Format(Now, "dd-mmm-yy") & ".xlsm"
Dname = "Industry_" & Dname
Worksheets("Industry").Activate
With ActiveWorkbook
.SaveAs "P:\Archives\" & Dname
.SaveAs "C:\Users\tom\Desktop\" & Dname 'Can be a variable
'.Close 0 ' this would close the workbook
End With
'Now Call RDB_Workbook_To_PDF
Application.Run ("RDB_Workbook_To_PDF")
End If
End If
Last edited: