file save as

  • Thread starter Thread starter leeners82
  • Start date Start date
L

leeners82

I am attempting to create a macro that will take the active file an
"save as" in a mmyy format. Anybody know how to do this
 
try this in your macro (change the sub name to what ever)

Sub test()

Dim temp As String
If Len(Month(Date)) = 1 Then
temp = "0" & Month(Date) & Left(Year(Date), 2)
Else
temp = Month(Date) & Left(Year(Date), 2)
End If

ThisWorkbook.SaveAs temp

End Sub

hope this help
 
Another version:

Option Explicit
Sub test2()
Dim temp As String
temp = Format(Date, "mmyy") & ".xls"
ThisWorkbook.SaveAs Filename:=temp, FileFormat:=xlWorkbookNormal
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top