Cursor is upon a word of a sentence.
and
I have this:
monotony
I want this:
(monotony)
Cursor is upon a word of a sentence.
and
I have this:
monotony
I want this:
(monotony)
This should work
Sub Macro1() Dim orng As Range Set orng = Selection.Words(1) Do While Right(orng, 1) = Chr(32) orng.End = orng.End - 1 Loop orng.InsertAfter ")" orng.InsertBefore "(" Set orng = Nothing End Sub
Graham Mayor - MS MVP (Word) 2002-2019
Visit my web site for more programming tips and ready made processes
http://www.gmayor.com
Note that Graham's macro works with the insertion point (cursor) in the word. It does not work when just the mouse pointer (cursor) is over the word.
I used wrong word. I should have used 'Insertion Point'. Thanks for bringing it to mind.
Thanks. It worked well.
I had lost hope when I saw the notice in the Forum that 'You can not post any thing' 'Simils are on' etc. So I was not checking the Forum post.
Thanks. It worked well for English Font. But one thing more, What if the word is in font 'Kurti Dev 010': In Hindi 'Full stop' is a letter 'n' and English Capital 'A' is a Full Stop. This macro does not take 'Full stop' in word.
I have this Hindi Word (Kurti Dev 010) with Full stop at last.
jke'kj.kA
I want This:
¼jke'kj.k½A
¼ is an opening bracket and ½ is a closing bracket.
Last edited by anilsharaf; 06-30-2021 at 09:53 PM. Reason: forgot someting to tell