Remove the line in word in replace replace method

Hello,
How to remove the line in word automation
I am using the word activity in that we have a primary name and secondary name is there hear the primary name is compulsory and secondary is not but sometimes secondary name also come some times so am using hear if-condition You just look the screenshot you will get but hear the thing is I don’t want that empty line so anyone tells how to remove the empty line.

image

image

image

Can Anyone help me how to remove this,
I hope I will get a reply from anyone.

Thanks!
Chethan P

Have you tested with:

Search for: "^pSecond Name!"
Replace with: ""

You might need to test with "^lSecond Name!" also if you have a different kind of line break in the Word document.

1 Like

Can you please explain I didn’t get you what you are saying I try to replace with “” this one its not working

OK, that’s strange. Do you get any error message?

I just tested on my computer and it’s working fine.

image

image image

2 Likes

Thanks its Working!!!

Can You Please explain that code. its really helps us who are all read this

Thanks
Chethan P

Great to hear! The ^p is for the “line break” (technically it’s the paragraph mark). So when replacing "^pDuck" with "", you remove the text Duck but also the line break before the text.

You can find more special characters in Word, by clicking on the Special button in Search and Replace dialog box.

1 Like

Thank You very much! its helps me :partying_face: :blush: :innocent:

Thanks
Chethan P

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.