Excel VBA MacOS上的转义引号

Excel VBA MacOS上的转义引号,excel,vba,shell,escaping,quotes,Excel,Vba,Shell,Escaping,Quotes,我想用VBA在Excel中执行一个shell脚本。但是,我需要在命令中使用引号“。要想知道如何在函数MacScript中转义引号,我只需用一个简单的命令尝试一下,但总是失败 下面是一个工作示例: Function HTTPGet2() As String HTTPGet2 = MacScript("do shell script ""echo 'hello' """) End Function 输出:hello 但是现在我想显示他“llo”。下面两个例子我都试过了,但都失败了 尝试1: F

我想用VBA在Excel中执行一个shell脚本。但是,我需要在命令中使用引号
。要想知道如何在函数
MacScript
中转义引号,我只需用一个简单的命令尝试一下,但总是失败

下面是一个工作示例:

Function HTTPGet2() As String

HTTPGet2 = MacScript("do shell script ""echo 'hello' """)

End Function
输出:
hello

但是现在我想显示
他“llo”
。下面两个例子我都试过了,但都失败了

尝试1:

Function HTTPGet2() As String

HTTPGet2 = MacScript("do shell script ""echo 'he""llo""' """)

End Function
尝试2:

Function HTTPGet2() As String

HTTPGet2 = MacScript("do shell script ""echo 'he"& Chr(34) &"llo"& Chr(34) &"' """)

End Function
你们能给我解释一下为什么它不工作以及如何让它工作吗?我在
10.14.4(18E226)

最后,这是我要执行的命令:

xmllint --html -xpath 'string(//*[@id="AssetAllocationLongShortTable1"]/table/tbody/tr[1]/td[1])' http://tools.morningstar.de/de/xray/default.aspx\?LanguageId\=de-DE\&PortfolioType\=2\&SecurityTokenList\=F000000EM3\]2\]0\]ETEXG$XETR\|F00000J8T2\]2\]0\]FODEU$$ALL\&values\=50.00\|50.00\&CurrencyId\=EUR\&from\=editholding
但这也不管用

Function HTTPGet2() As String

    HTTPGet2 = MacScript("do shell script "" xmllint --html -xpath 'string(//*[@id\""AssetAllocationLongShortTable1\""]/table/tbody/tr[1]/td[1])' http://tools.morningstar.de/de/xray/default.aspx\?LanguageId\=de-DE\&PortfolioType\=2\&SecurityTokenList\=F000000EM3\]2\]0\]ETEXG$XETR\|F00000J8T2\]2\]0\]FODEU$$ALL\&values\=50.00\|50.00\&CurrencyId\=EUR\&from\=editholding """)

End Function

Applescript有自己的转义要求…
MacScript(“do shell script”“echo'he\”“llo\”“”)
谢谢@TimWilliams!-我已经添加了我想要执行的最后一个命令..我已经用
尝试过了”“
但不知何故,它不起作用。。你知道为什么吗?由于反斜杠
\
用于转义下一个字符,因此你还需要通过将命令中的任何
\
加倍来转义它们
\
MacScript(“do shell script”“xmllint--html-xpath”字符串(//*[@id\”“AssetLocationLongshortable1\][/table/tbody/tr[1]/td[1]))' http://tools.morningstar.de/de/xray/default.aspx\\?LanguageId\\=de\\\&PortfolioType\\=2\\\&SecurityTokenList\\=F000000EM3\\]2\\]0\\]ETEXG$XETR\\\\\\\\\\\]2\\\]0\\\\]FODEU$$ALL\\\\\\\\\&values\\\\\=50.00\\\\\\\\\&CurrencyId\\\\\\\=EUR\\\\\\\\\\\=fro\\\\=editholding''”
-这。。用“\”试过了。你能给我举个例子吗?对不起,我不在Mac上,所以无法帮助测试…Applescript有自己的转义要求<代码>MacScript(“DoShell脚本”“echo”“he\”“llo\”“”)谢谢@TimWilliams!-我已添加了要执行的最终命令。。我已经用
\”“
试过了,但不知怎么的,它不起作用。。你知道为什么吗?由于反斜杠
\
用于转义下一个字符,因此你还需要通过将命令中的任何
\
加倍来转义它们
\
MacScript(“do shell script”“xmllint--html-xpath”字符串(//*[@id\”“AssetLocationLongshortable1\][/table/tbody/tr[1]/td[1]))' http://tools.morningstar.de/de/xray/default.aspx\\?LanguageId\\=de\\\&PortfolioType\\=2\\\&SecurityTokenList\\=F000000EM3\\]2\\]0\\]ETEXG$XETR\\\\\\\\\\\]2\\\]0\\\\]FODEU$$ALL\\\\\\\\\&values\\\\\=50.00\\\\\\\\\&CurrencyId\\\\\\\=EUR\\\\\\\\\\\=fro\\\\=editholding''”
-这。。用“\”试过了。你能给我举个例子吗?对不起,我不在Mac上,所以无法帮助测试。。。