Consulting

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. #1
    VBAX Newbie
    Joined
    Feb 2023
    Posts
    2
    Location

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

    Dear Community,

    I would like to convert the number sequence (ASCII) 115 116 101 112 104 102 97 110 back to text (one word) with StrConv + vbUnicode. Unfortunately, I don't know how to use the For-Next loop in this case.

    I converted the text in the number sequence as follows (found with Google) - but I just can't get it back to text. Can someone please help me or give me some tips. Many thanks and best regards Stephfan

    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)
    x = StrConv(str1, vbFromUnicode)
    For i = 0 To UBound(x)
      str2 = str2 & " " & x(i)
    Next i
    Cells(1, 2).Value = Trim(str2)
    End Sub
    Last edited by Aussiebear; 02-01-2023 at 03:46 PM. Reason: Added code tags to supplied code

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
  •