There is a work around you may try. The idea is that we can get the parent element of the selection if the text we selected contains the <a>
tag, then we remove the this element directly. After that we insert the new html at this selection place using pasteHTML again. Here is the code:
//doc is a IHTMLDocument2 obejct.
IHTMLTxtRange range = doc.selection.createRange();