Hello Everyone
I am trying to re-name the file of an active workbook based on the contents of a cell.
Thanks to the group I have managed this (sort of) but my current code is creating another copy of the file with the desired file name.
What I need is the original file re-naming.
The code I am using is:-
Sub Macro1()
Dim mypath
Dim ThisFile As String
Dim StartFile As String
StartFile = ThisWorkbook.Name
mypath = Workbooks(StartFile).Path
If Right(mypath, 1) <> "\" Then mypath = mypath & "\"
On Error Resume Next
If ThisWorkbook.Name = "Testing.xls" Then
ThisFile = mypath & Range("A1").Value
'ActiveWorkbook.SaveAs Filename:=ThisFile 'note1
ActiveWorkbook.Name = ThisFile 'note2
End If
'note1 Works but creates new file as well as original
'note2 Attempt to rename existing - gives compile error
'Cant assign to read-only property
End Sub
Can anyone help?
Kenny
Win Me and 2000
Office 97 and 2000
Bookmarks