how to parce out part of a string and replace it with another stri

L

Lisab

Problem:
I have sereral files with simular names.
I would like to be able to replace part of the file name with a persons name

I want to replace the "Master" in the file name with [LastName]

Example:
November5MasterAssignmentFile1.xml --> November5JonesAssignmentFile1.xml
November12MasterAssignmentFile3.xml --> November5SmithAssignmentFile1.xml

Question:
Do I have to figure out an InString coding logic to accomplish this?
Is there a find and replace function or Code example I can use?

Thanks.
 
R

Robert Morley

All you need to do is:

strNewFileName = Replace(strOldFileName, "Master", [LastName])



Rob
 
L

Lisab

OH YES!
My mind was stuck on using the Mid, InStr, Right functions. I forgot about
the Replace function.
THANKS!

Robert Morley said:
All you need to do is:

strNewFileName = Replace(strOldFileName, "Master", [LastName])



Rob

Lisab said:
Problem:
I have sereral files with simular names.
I would like to be able to replace part of the file name with a persons name

I want to replace the "Master" in the file name with [LastName]

Example:
November5MasterAssignmentFile1.xml --> November5JonesAssignmentFile1.xml
November12MasterAssignmentFile3.xml --> November5SmithAssignmentFile1.xml

Question:
Do I have to figure out an InString coding logic to accomplish this?
Is there a find and replace function or Code example I can use?

Thanks.
 

Ask a Question

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.

Ask a Question

Top