逃离角色
VBA 语法要求字符串文字出现在 "
标记内,所以当你的字符串需要包含引号时,你需要使用额外的 "
来转义/添加 "
字符,以便 VBA 理解你打算将 ""
解释作为 "
字符串。
'The following 2 lines produce the same output
Debug.Print "The man said, ""Never use air-quotes"""
Debug.Print "The man said, " & """" & "Never use air-quotes" & """"
'Output:
'The man said, "Never use air-quotes"
'The man said, "Never use air-quotes"