• 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
https://www.neowin.net/forum/topic/1125596-save-a-file-by-macro/
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.

This topic is now closed to further replies.
  • Posts

    • Huh? I have an Aeron Remastered and the backrest cannot go up or down (only the lumbar is adjustable). Yes, the Doro C300 Pro V2's backrest can be locked, but the locking mechanism is so weak that when you recline and lean back the backrest moves with your body. I think the whole purpose of this chair is that all of the moving parts (except for the rocking, which can be locked in place) are supposed to move with your body, as you shift your weight, that's why I couldn't get used to it. Some people might like it though. Its redeeming factor is the price, I mean it costs like a quarter of what a new Herman MIller (Aeron) costs.
    • Well done Massie. This is how to treat the Fox News filth.   
    • I notice how you dodged the questions I had about the racism shown by ignorant, gullible, cowardly people when the Poles, like your partner, were the immigrants. Ahem. I wonder how you'd feel if native born Brits suddenly treated you as "dirty crooked immigrant" for being half Trump-American? If they ordered you to leave and "go back to your corrupt country" (on the other side of the Atlantic), would you go? The truth is based on facts as supported by evidence. As requested in your previous posts, I have used the facts in your own post to show everyone the truth.
    • US citizens are paying to their government, who could use that to fund healthcare and tuition and relieve the costs of these for citizens instead of making tax breaks that overwhelmingly favor the rich. I'm not saying that tariffs are the correct solution, but what else would they be used for? What else could Trump have in mind for wanting them, if he hasn't figured out that labor costs are higher in the US?
  • Recent Achievements

    • Conversation Starter
      jessse3334 earned a badge
      Conversation Starter
    • Reacting Well
      JuvenileDelinquent earned a badge
      Reacting Well
    • One Month Later
      Excellence2025 earned a badge
      One Month Later
    • Week One Done
      Excellence2025 earned a badge
      Week One Done
    • Week One Done
      flexorcist earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      506
    2. 2
      +Edouard
      207
    3. 3
      PsYcHoKiLLa
      151
    4. 4
      Steven P.
      73
    5. 5
      macoman
      62
  • Tell a friend

    Love Neowin? Tell a friend!