• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

Save a file by macro


Wannes    34

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 & " "
Application.DisplayAlerts = True
End Sub

Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
mastermate    2

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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.