We have some VBA code in MS Word 2010 which needs to display Persian (Farsi) words dynamically; in other words, depending on which buttons the user clicks on the VBA app window, we will display a different string of Persian.
The only way we discovered to do this was to use something like this and concatenate a very long string character by character: the ChrW(&633)
. Do you know another way we can do this? The strings will remain the same, but we need a couple of different ones. Can they be loaded from a file?
Your help is much appreciated. Thanks.
Lets have an UTF-8 text file unicode.txt, a form UserForm1 with label Label1 and Button CommandButton1:
'ensure reference is set to Microsoft ActiveX DataObjects library
'(the latest version of it) under "tools/references"
Dim adoStream As ADODB.Stream
Dim var_String As Variant
Set adoStream = New ADODB.Stream
adoStream.Charset = "UTF-8"
adoStream.Open
adoStream.LoadFromFile "unicode.txt"
Label1 = adoStream.ReadText
adoStream.Close
来源:https://stackoverflow.com/questions/17698260/ms-word-vba-to-display-unicode-strings