只需使用Len()并Replace()检索字符串的长度并删除空格.例如:
Const strText As String = "The quick brown fox"
Debug.Print "Original length: " & Len(strText) ' => 23
Debug.Print "Length w/o spaces: " & Len(Replace$(strText, " ", "")) ' => 16
Run Code Online (Sandbox Code Playgroud)