Thread: Files SAVE AS
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Files SAVE AS

myfile = ThisWorkbook.Name
'test if there is a file extension
StrDate = Format(Date, "mm-dd-yy")
If InStr(myfile, ".") 0 Then
Pre = Left(myfile, InStr(myfile, ".") - 1)
Post = Mid(myfile, InStr(myfile, "."))
NewName = Pre & "_" & StrDate & Post
Else
NewName = myfile & "_" & StrDate & ".xls"
End If

ThisWorkbook.SaveAs Filename:=NewName

"Rpettis31" wrote:

I am trying to write a macro that will allow me to save a file as a "myfile,
plus the current date in xls. The macro has already converted the "myfile"
from a text format.