excelvbazero-width-space

Inserting zero-width space after each symbol


I need to place a zero-width space after each character within the texts in MS Excel document.
Two important conditions:

Amount of texts is huge so it's a pain to put them in manually.

I tried to find any suitable VBA-module out, but with no success.

Maybe it's possible to perform such action in another application and then import the texts back to Excel? That's solution is also acceptable.

Thanks in advance.

P.S. Exceptions (Latin characters):

65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122


Solution

  • Assuming:

    U+200B

    This little macro:

    Sub dural()
        Dim zws As String, A1 As String, L As Long, i As Long
        Dim temp As String
    
        zws = ChrW(8203)
        A1 = Range("A1").Text
    
        L = Len(A1)
        For i = 1 To L
            temp = temp & Mid(A1, i, 1) & zws
        Next i
    
        temp = Mid(temp, 1, Len(temp) - 1)
        MsgBox A1 & vbCrLf & temp
    
        Range("A2").Value = temp
    End Sub
    

    will produce:

    enter image description here

    NOTE:

    The character may be zero-width, but not zero-length!