manman89

VBA CONVERT STRING TO ASCW, CONVERT ASCW TO CHRW

Aug 10th, 2017
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. VBA CONVERT STRING TO ASCW, CONVERT ASCW TO CHRW
  2.  
  3. Function AscW_From_Char(DLieu As String) As String
  4. Dim Temp As String
  5. Dim i As Integer
  6. For i = 1 To Len(DLieu)
  7. Temp = Temp & AscW(Mid(DLieu, i, 1)) & ","
  8. Next i
  9. AscW_From_Char = Temp
  10. End Function
  11.  
  12. Function ChrW_From_AscW(DLieu As String) As String
  13. If Trim(DLieu) = "" Then
  14. ChrW_From_AscW = "Error"
  15. Exit Function
  16. End If
  17. Dim i As Integer
  18. Dim Temp As String
  19. Dim Temp_Number As Integer
  20. Dim zArr() As String
  21. zArr = Split(DLieu, ",")
  22. For i = LBound(zArr) To UBound(zArr)
  23. Temp_Number = Val(Trim(zArr(i)))
  24. If Temp_Number <> 0 Then
  25. Temp = Temp & ChrW(zArr(i))
  26. End If
  27. Next
  28. ChrW_From_AscW = Temp
  29. End Function
Advertisement
Add Comment
Please, Sign In to add comment