Monday, July 27, 2009

Coding for Visual Basic to create Macro in Excel?

I am trying to have an automatic save function in my macro. The problem I am having is that I want the file name to use the current date so the user does not have to create a file name when it saves. This is what I want:


ActiveWorkbook.SaveAs Filename:="C:\Files\Today's Date.xml"





The thing I want is for Today's Date to actual read the day's date as 11-22-2006 or whatever that day's date is. Does anyone know the function to have this work correctly?

Coding for Visual Basic to create Macro in Excel?
Here's the command I use:





NewFileName = "My_File_" %26amp; Replace (Str (Format(Now, "yyyymmddhhmmss")), " ", "")





I have it formatted down to hours, minutes and seconds. I do this so that I can save the file as often as I want and get a new file name every time.





Hope this helps!





Regards,


QwertyKPH @ Yahoo!

curse of the golden flower

No comments:

Post a Comment