Dim myChar As Char
throws a compilation error: "Custom type not defined"
What reference should be included in type Char?
Chartype does not exist in VBA, should be used instead String.
Char
String
Dim myChar As String
Please note that VBA does not match VB.NET. In VB.NET you can use Char.
EDIT: Following Michał Krzych's suggestion, I am using a fixed-length string for this particular purpose.
Dim myChar As String * 1
Here is an excerpt from the "VBA Developer Reference" by Ken Goetz and Mike Gilbert :
" VBA , , ".... " , , . , , . ."
, ;
Sub foo (char * 1) '
...
Sub
Sub foo (char ) '
, , , . VBA , .
, , :
Sub Test() Dim strA As String, strB As Byte, strC As Integer, strD As Long strA = "A" strB = 65 strC = 75 strD = 90 Debug.Print Asc(strA) '65 Debug.Print Chr(strB) 'A Debug.Print Chr(strC) 'K Debug.Print Chr(strD) 'Z End Sub