Macro assigned to a button
I think Don was just showing a sample so you could see how to use the Name
statement.
If you want to save an open workbook as a new name and then delete the original
workbook, you could do something like this (with absolutely no checks at all!):
Option Explicit
Sub testme()
Dim OldName As String
Dim NewName As String
NewName = "C:\changethistowhatyouneed\filename.xls"
With ActiveWorkbook 'or ThisWorkbook????
OldName = .FullName
.SaveAs Filename:=NewName, FileFormat:=xlWorkbookNormal
End With
Kill OldName
End Sub
Sadcrab wrote:
"Don Guillett" wrote:
maybe this simple idea will help?
Sub movefile()
OldName = "C:\oldfolder\oldname.xls"
NewName = "C:\newfolder\newname.xls"
Name OldName As NewName
End Sub
--
Thanks Don but I can't get it to work. I get a runtime error 53 File not
found more help on this please. Thanks
--
Dave Peterson
|