Hello Orangeworker,
Unfortunately, colors are not rendered in the code window. You will need to bold the lines or add comments so I know which to look at.
Hello Orangeworker,
Unfortunately, colors are not rendered in the code window. You will need to bold the lines or add comments so I know which to look at.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Sorry about that. The bold text is turning yellow when I run the code with the break points.
![]()
Sub RenameFiles() Dim FileName As String Dim FilePath As String Dim NewFileName As String Dim RegExp As Object Dim vFolder As Variant Set RegExp = CreateObject("VBScript.RegExp") RegExp.IgnoreCase = True RegExp.Pattern = "(.+)(O\-.+)(\..*)" FilePath = "D:\Publishing\Catalog\" RegExp.test (FileName) NewFileName = RegExp.Replace(FileName, "$1$3") For Each vFolder In Array("Vox", "Ins") FileName = Dir(FilePath & vFolder & "\*.*") While FileName <> "" If RegExp.test(FileName) Then NewFileName = RegExp.Replace(FileName, "$1$3") Name FilePath & vFolder & FileName As FilePath & vFolder & NewFileName End If FileName = Dir() Wend Next vFolder End Sub
Hello Orangeworker,
Did you change the file path? The PDF shows yet another path??? Which am I to believe?
![]()
'Originally FilePath = "E:\Publishing\Catalog\" 'PDF Path FilePath = "D:\Publishing\Catalog\Alexander\"
Hello Orangeworker,
How many break points to add? You only needed to add one where I specified to check if the file path and name were correct. What values did you see?
Okay, this is where we're going wrong. The path listed in the PDF is correct. "Alexander" is an artist, but their are many different artist names (folders) in that section of the directory. Does that clear it up?
![]()
'PDF Path FilePath = "D:\Publishing\Catalog\Alexander\"
The values listed below are what I'm getting when inserting the break point on
![]()
Name FilePath & vFolder & FileName As FilePath & vFolder & NewFileName
FilePath="D:\Publishing\Catalog\Alexander\"
FileName="Be Careful What You Wish For O-0007.wav"
vFolder= "Vox"
Hello Orangeworker,
I am still clear on on how you have these directories setup. If you various folders based on the artists names in the main path "D:\Publishing\Catalog\" then there needs to extra step in the macro to open these artists' folders, unless you are looking only in the folders "Vox" and "Ins".
My question is then which path should the macro be using: "D:\Publishing\Catalog\Alexander\Vox" or "D:\Publishing\Catalog\Vox" ? If artist needs to included then I will need to change the macro.
Hi Leith,
Sorry for the miscommunication. What I can do is just list all the file paths for all of my artists. Would the example below work?
![]()
FilePath = "D:\Publishing\Catalog\Alexander\Ins\" FilePath = "D:\Publishing\Catalog\Alexander\Vox\"
And so on for the other artists..
But with that said, this path still doesn't remove O-*
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks