Hi, hoping someone can help me
I am using the below code for an 'Autosave' button which saves a copy of a spreadsheet and adds a date stamp. This is used on a checklist form which needs to be completed by maintenance engineers. Once they have completed the form, they click the autosave button and a copy of the completed form is saved showing that their maintenance checks have been completed on a given date.
I am trying to add this button on to other forms they use as they have all said it has made life a bit easier simply being able to autosave these forms and we have an electronic library of all the maintenance forms saved. The trouble I am having is that the button can be added to some forms successfully, but other forms will not run the macro. I have a feeling it might be something to do with the length of the filename but am not 100% sure on this. The filename is just under 200 characters long.
The code being used is:
Sub AUTOSAVE()
Dim nom As String
nom = Day(Date) & "-" & Month(Date) & "-" & Year(Date) & "_" & ActiveWorkbook.Name
ActiveWorkbook.SaveCopyAs ActiveWorkbook.Path & "\" & nom
rep = MsgBox("You database has been saved : " & Name, vbYes + vbInformation, "Copy of spreadsheet")
End Sub
If I try to run this macro on certain worksheets I get runtime error 1004. if I hit 'debug' it shows this line of the code in yellow:
ActiveWorkbook.SaveCopyAs ActiveWorkbook.Path & "\" & nom
Any ideas on how I can make this work on all forms please.
Many thanks.
Bookmarks