[vba] Getting char from string at specified index

As stated how to get char from string at specified index in the visual basic? I look through google and these do not work:

s(index) , s.Chars(index),s,Characters(index)

So how to get char at specified index?

This question is related to vba ms-word

The answer is


char = split_string_to_char(text)(index)

------

Function split_string_to_char(text) As String()

   Dim chars() As String
   For char_count = 1 To Len(text)
      ReDim Preserve chars(char_count - 1)
      chars(char_count - 1) = Mid(text, char_count, 1)
   Next
   split_string_to_char = chars
End Function

Getting one char from string at specified index

Dim pos As Integer
Dim outStr As String
pos = 2 
Dim outStr As String
outStr = Left(Mid("abcdef", pos), 1)

outStr="b"