Hi, I'm trying to rename a file with VBA so that the original file and the reviewed file are on the network drive in the same folder.
P:\Compliance\4000\RD2\RG Round 2.xls is compared to P:\Compliance\4000\RD1\RG Round 1.xls to identify which cells have changed.
P:\Compliance\4000\RD2\RG Round 2.xls should then be saved as P:\Compliance\4000\RD2\Checked RG Round 2.xls so that we have the original and the version with changed cells highlighted.
The code I'm using is failing at ActiveWorkbook.SaveAs.
Thanks in advance.
Steve
P:\Compliance\4000\RD2\RG Round 2.xls is compared to P:\Compliance\4000\RD1\RG Round 1.xls to identify which cells have changed.
P:\Compliance\4000\RD2\RG Round 2.xls should then be saved as P:\Compliance\4000\RD2\Checked RG Round 2.xls so that we have the original and the version with changed cells highlighted.
The code I'm using is failing at ActiveWorkbook.SaveAs.
Code:
Sub ChangeFileName()
Dim sFileNameChange As String
Dim sFile3 As String
sFileNameChange = ActiveWorkbook.FullName
sNewFileSplit = Right(sFileNameChange, Len(sFileNameChange) - InStrRev(sFileNameChange, "\"))
sNewPathSplit = Left(sFileNameChange, Len(sFileNameChange) - InStrRev(sFileNameChange, "\"))
sNewFileSplit2 = "Checked " & sNewFileSplit
sNewPathSplit2 = sNewPathSplit & "\"
sFile3 = sNewPathSplit2 & sNewFileSplit2
ActiveWorkbook.SaveAs Filename:=sFile3, FileFormat:=xlExcel8
End Sub
Thanks in advance.
Steve