Private Sub Command1_Click()
    Dim strLen As Integer
    Dim strMid As String
    Dim i As Integer
    Dim strTxt As String
    strTxt = Trim$(Text1.Text)
    For i = 1 To Len(strTxt)
        strMid = Mid$(strTxt, i, 1)
        If strMid <> " " Then
            strLen = strLen + 1
        End If
    Next
    Print strLen
End Sub