Results 1 to 4 of 4

Thread: Convert ASCII code back to text with StrConv + vbUnicode (VBA)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    ' arnelgp
    Sub zuASCII()
        Dim str1 As String, str2 As String
        Dim i As Integer
        Dim x() As Byte
        str1 = Cells(1, 1).Value                 '(in dieser Zelle steht der Text)
        ' assign str1 to x
        x = str1
        ' now X will contain 115,0,116,0,101,0...(ascii seperated with "0")
        '
        ' loop through each element of byte array
        For i = 0 To UBound(x) Step 2
            Debug.Print x(i)
        Next
        '
        ' convert the array of byte again to string
        str2 = x
        Debug.Print str2
    End Sub
    note: the Loop (For i = 0...) is not necessary, it is only there to show the values of x (Array of bytes).
    Last edited by arnelgp; 02-01-2023 at 08:35 PM. Reason: explain further

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •