The keyValue is returing a value that the string length is too large. I have tested this function and it looks like the max is 255 - is it possible to increase this to an unpredefined length.
Try passing it with the ByVal or ByRef keywords. If that doesn't work, try passing it as an array insteaad, then join it inside the procedure with an empty string ("")
I am not familiar enough with VBS - but the keyValue will be greater than 255 thus using
will replace the winword bookmark with an empty string
I am in favour of using the clipboard feature as described in another forum. There is an opportunity for the user to copy something when the bookmarks are being replaced.