Discussion:
Insert Unicode Characters Into Code
(too old to reply)
Diamonds_Mine
2006-08-14 15:04:02 UTC
Permalink
In my macro, I need to insert the following text: "Liczba stron łącznie z
tytułową". However, I need assistance with inserting the special characters
that are being used. When I copy/paste the text from a Word document, some
of the characters become question marks. This is the code:

Selection.TypeText "Liczba stron ??cznie z tytu?ow?:"
ActiveDocument.Bookmarks("lblFipo").Select

Thank you for any assistance you can provide.
Dave Lett
2006-08-14 15:16:12 UTC
Permalink
Hi,

You will need to know the unicode character number for each of the special
characters that you're trying to insert. You can select each special
character and use the following to get the unicode character:

MsgBox AscW (Selection.Text)

which returns 322 for the l character

Therefore, if I want to insert the first word in your example, I would use
something like the following:

Selection.InsertSymbol CharacterNumber:=322, Unicode:=True
Selection.InsertSymbol CharacterNumber:=261, Unicode:=True
Selection.TypeText "cznie"

HTH,
Dave
In my macro, I need to insert the following text: "Liczba stron lacznie z
tytulowa". However, I need assistance with inserting the special
characters
that are being used. When I copy/paste the text from a Word document, some
Selection.TypeText "Liczba stron ??cznie z tytu?ow?:"
ActiveDocument.Bookmarks("lblFipo").Select
Thank you for any assistance you can provide.
Klaus Linke
2006-08-14 20:24:40 UTC
Permalink
In my macro, I need to insert the following text: "Liczba stron lacznie z
tytulowa". However, I need assistance with inserting the special
characters
that are being used. When I copy/paste the text from a Word document, some
Selection.TypeText "Liczba stron ??cznie z tytu?ow?:"
ActiveDocument.Bookmarks("lblFipo").Select
Thank you for any assistance you can provide.
You could also crank up the macro recorder, paste the text in "Edit > Find",
and do a search.
That should give you a string to work with, something like
"Liczba stron " & ChrW(322) & ChrW(261) & "cznie z tytu" & _
ChrW(322) & "ow" & ChrW(261)

Klaus

Loading...