E
electrica7926
Does anyone have a macro that will rename excel files with text from
cell within the file
cell within the file
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Tom Ogilvy said:Dim sPath as String, sNameOld as StringDim sName as StirngDim i as LongWith
Application.FileSearch .NewSearch .LookIn = "C:\My Documents"
.SearchSubFolders = True .FileName = ".xls" .FileType =
msoFileTypeExcelWorkbooks If .Execute() > 0 Then For i = 1 To
.FoundFiles.Count set wkbk = workbooks.open( .FoundFiles(i))
sPath = wkbk.Path if right(spath,1) <> "\" then spath = spath &
"\" sNameOld = wkbk.FullName sName =
wkbk.Worksheets(1).Range("A1").Value wkbk.close SaveChanges:=False
name sNameOld as sPath & sName Next i Else MsgBox "There
were no files found." End IfEnd With-- Regards,Tom Ogilvy"electrica7926
msoFileTypeAllFiles" and it worked. I don't know why it didn't work before,JoyB said:Nevermind! I added the ".MatchTextExactly = True" and ".FileType =
Tom said:*It used to be that rename meant
"C:\Source Directory" = "C:\Destination Directory\"
and the file ceased to exist under the old name.
Maybe not anymore, eh?*
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.