Replace in a string variable

H

Hege M

Hi.

I am trying to replace space with hard space in i string variable.
I found that space was chr(32) but I haven't been able to find the ascii
code for hard space. The bookmark is in the footer section so I can't use
ordinary find/replace.

The code I am trying to use is:
Dim var As String
Dim ferdig As String
var = "Hei dette er Hege"
ferdig = Replace(var, Chr(32), Chr(?), 1, Len(var))
ActiveDocument.Bookmarks("Test").Range.Text = ferdig

If anyone know what to put insted of ? or have an alternative way of doing
this I would be very grateful.

Hege
 
P

Philippe boudreau

Quick Google search gave me this..
....The hard space is ascii character 160 or A0h (hexadecimal) ...

HTH

P.
 
H

Hege M

Hi!

Great, no it works. Thank you.
(I'll search Google before I ask next time)
Hege

Philippe boudreau skrev:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top