I'm doing an open brainstorm right now of how to do this and am simply looking for a more efficient way (if there is one) to find a common suffix of a file. What I'm doing is renaming a set of files (parent project, children files, and chilren's children files), opening the new file, and resolving the links between the parts. Well, that's the basic way to explain it anyways. I'm very excited that I started learning VBA two weeks ago and am already almost done!
What I need to do to resolve the links is use the following:
Component.Replace("Old Part","New Part",False)
However, the way my files are set up are as follows:
Parent:
MyCodeWorks1.ipj
Children:
MyCodeWorks1-001.iam
MyCodeWorks1-002.iam
Children of Children:
MyCodeWorks1-003.ipt
MyCodeWorks1-004.ipt
MyCodeWorks1-005.ipt
MyCodeWorks1-006.ipt
etc.
I then rename my parent file to, say, "Yay32.ipj". All prefixes "MyCodeWorks" then change to prefix "Yay32". To fit the format for the replace component procedure, I need to grab the suffixes "001","002","003",etc.
I have two ideas so far and would love more input. I'm new to VBA and really don't know the most efficient way to do things yet. I'm posting my ideas below! Does anyone have a better or more efficient idea? This is more theoretical; I wouldn't need the actual code, just an idea!
1) When the user inputs "Old Name" and "New Name" into the initial renaming process, I could have it calculate the number of characters in each string and then skip that many characters in each to find the common suffix.
2) Search for the full prefix ("001")...this could cause problems because sometimes a file might read, say, SD5 001 - 001 . But maybe there's a way to search for that prefix after the hyphen, adding i=1 each time in a loop?
Thanks for any ideas ahead of time!!!