file save as

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
 
T

TheGuy

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
 
D

Dave Peterson

Another version:

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