PDA

View Full Version : VBA - Replace word with a condition



Sweety
01-04-2016, 01:15 AM
Hi,

I have written a code to replace certain words with its corresponding values in a word doc. which is working well.
But, I'm held up in one scenario for which I need assistance.

I have one particular word in my document called "DATE" which has to be either replaced by "StartDate" or "EndDate".
Here, I need a code which should read the whole word document.
If it finds a word called "End", the word "DATE" must be replaced with "EndDate".
Else, by default, the "DATE" can be replaced with "StartDate" itself.

Can anyone please help me?

Thank you!