Convert selected text to bold
I am trying to write a script that will convert selected text to bold. However, there are two drawbacks that I can't get around:-
1) If the text is "Harry met Sally" and i highlighted met , I get "Harry met met Sally" rather than "Harry met Sally". so it repears the highlighted text.
2) If i had "Dog jumped over the moon." and i highlighted over I get "Dog jumped over over the moon." - i.e i can't figure out a way of retaining existing formatting.
can anybody help ? thanks