Solved How to transfer string in character

Batocanin

New member
Local time
Today, 19:06
Joined
May 30, 2022
Messages
7
Is there any way to do this
imput 123.45
result '1','2','3','.','4','5'
 
Yes.
Use Mid() function to get each character, within a loop using Len() to determine how big the loop is.
Surround it with ' and add a ,
Concatenate that string to your output string each time.
Remove the final , with Len(outputstring) - 1 and Left() function.
 
Is there any way to do this
imput 123.45
result '1','2','3','.','4','5'
Do what exactly?
Is result supposed to be an array of characters or a string?

If this is about creating the result as a string, then refer to @Gasman's reply.

If you want an array of characters, you are somewhat out of luck as VBA has no char data type. I believe the closest to the desired result is:
Code:
Const inputData As String = "123.45"
Dim resultData() As Byte
   
resultData = StrConv(inputData, vbFromUnicode)
However, this obviously results in an array of bytes. You need to use the Chr()-Function on each element of the array to get the character representation of the byte.
 
Thank you Gasman
Mid function with a loop did it perfect.
Thanks once again.
 

Users who are viewing this thread

Back
Top Bottom