Writing Chinese characters to the registry using VBA RRS feed

  • Question

  • I have a user form that allows a person to type in Chinese characters into a form and then insert the text into a document when they click OK.  I want to then take the Chinese text and write it to the Registry.

    I am using the following commands to write to the registry:

        Dim myRegistryWrite As Object
        Set myRegistryWrite = CreateObject("WScript.Shell")
        With myRegistryWrite
            .regwrite strRegistryDestination(1), strRecipientName

    My problem is that although the user types 汉字 / 漢字 and is inserted into the document correctly, I get ??? / ???? in the Registry entry.

    What is baffling to me is that I can copy and paste the text correctly into the registry key and everything is fine.  If I use VBA to update the value, I get the ??? / ??? symbols instead.

    I am running Office 2010 and Windows XP


    Any help would be appreciated,

    thank you.

    Friday, July 15, 2011 1:18 PM


  • I'm not sure whether the problem is string conversion by VBA, or misinterpretation by WScript.Shell, but try, instead, ...
        System.PrivateProfileString("", "HKEY_CURRENT_USER\Whatever\KeyName", "ValueName") = strRecipientName

    Friday, July 15, 2011 4:39 PM