View Single Post
 
Old 02-18-2014, 09:49 AM
NobodysPerfect NobodysPerfect is offline Windows 7 64bit Office 2010 32bit
Competent Performer
 
Join Date: Jan 2014
Location: Germany
Posts: 136
NobodysPerfect is on a distinguished road
Default

As I always try not to use linked documents, I use my quick workaround for short terms:

Type the needed term in Word, select it and then call the following function.

Code:
Function GetUnicodeString(Optional UniCode As String) As String
Dim oData As New DataObject         'Link to Microsoft Forms 2.0 Object Library 
Dim i%
    
    If UniCode = "" Then UniCode = Selection
        For i = 1 To Len(UniCode)
            GetUnicodeString = GetUnicodeString & "ChrW(" & (AscW(Mid(UniCode, i, i))) & ") & "
        Next
        GetUnicodeString = Left(GetUnicodeString, Len(GetUnicodeString) - 3)
        
    With oData
        .SetText GetUnicodeString
        .PutInClipboard
    End With
    
    MsgBox "String in clipboard for use in VBA ...   ", vbOKOnly + vbInformation, "In Clipboard"

End Function
The "GetUnicodeString" function returns the corresponding ChrW()%ChrW()& ... string which can be pasted directly into the VBA code.

Only suitable for short strings in Userforms or ListBoxes, etc.

NP
Reply With Quote