tags:

views:

179

answers:

2

Been creating a simple program using VBA that I can use to review vocabulary in Chinese.

I've gotten a fair bit working so far, but have run into a huge problem with inputting a macron-character such as "ā" (unicode 257). The specific application I am working on right now involves changing the contents of the text-box form so that an "a" can automatically be replaced as I type into the text box. Such a procedure itself is easy--I can get it to work with the pinyin characters "á" and "à".

Select Case testchar
    Case "a"
    Mid(strclip, markloc, 1) = "ā"
End Select

The previous is an attempt at using the Mid function to replace one character in the textbox string with a pinyin character at the appropriate cue from the user.

The hangup is I can't enter the "ā" into VBA! I've been looking around the internet but this doesn't seem like a problem to anyone else. When I am in the VBA editor and I type alt + 0257, nothing happens. I can't copy-paste from notepad either.. I'm about ready to scrap VBA and redo this application in some other language..

Cheers

A: 

I don't have ms-office installed on my machine to try it.
However, you can use StrConv function with parameter for Unicode (alongwith LCID) to put the unicode content into the textbox.

Note that VB6 style controls dont accept unicode values.
If you are creating forms inside VBA editor, it should work (because it uses Forms 2.0 Library).

shahkalpesh
+1  A: 

You can use ChrW to generate Unicode characters:

Mid(strclip, markloc, 1) = ChrW(257)
Ozgur Ozcitak
+1 works for me too.