PDA

View Full Version : [SOLVED:] Using the VBA Replace function to delete an obscure character by its Hex code (Word).



johndavidson
12-08-2021, 09:06 AM
I'm trying to write a VBA statement in a Word macro that deletes an obscure character that has the Hex code of: F03C (using alt/X).

Having got the string containing the character into the variable sSave, I'm going:

sSave = Replace(sSave, ChrW("F03C"), "")

But it doesn't work. What's the right code?

Thanks

John Davidson

johndavidson
12-08-2021, 09:52 AM
Ah! Got it by recording a search for the character! Correct code (converted to decimal) is:

sSave = Replace(sSave, ChrW(61500), "")

Paul_Hossler
12-08-2021, 06:19 PM
You could also use



sSave = Replace(sSave, ChrW(&HF03C), "")

johndavidson
12-08-2021, 09:34 PM
Thanks. I'd tried:

sSave = Replace(sSave, ChrW(&F03C), "")

Didn't know it should have been: &HF03C