• 0

Save a file by macro


Question

I would like to save my file by clicking a simple button in an macro-enabled Excel document. The file should be saved as "Date Today" "Value A1". For example: 13-12-2012 LORD HINTON.xlsx

At the moment I thought I had found it but when clicking the button nothing happens. What is wrong with my code? What do I have to change?

Thanks in advance for advising me.


Sub Button133_Click()
Dim MyDate
MyDate = Date
Dim Test1Str As String
Test1Str = Format(MyDate, "DD-MM-YYYY")
ThisFile = Range("A1").Value
Application.DisplayAlerts = False
Application.Run ("SaveFile")

ActiveWorkbook.SaveCopyAs Filename:="/Gebruikers/Naam/Dropbox/Folder1/Folder2 - Algemeen" & Test1Str & " " & ThisFile & " "
ActiveWorkbook.Save
Application.DisplayAlerts = True
End Sub
[/CODE]

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Has the code been assigned to the button you are clicking?

Does the code work without clicking the button?

Just to say, it does work for me, after removing the 'Application.Run("Savefile")' line and changing the destination folder path since these are specific to you.

Link to comment
Share on other sites

This topic is now closed to further replies.