这是一个语法错误。如何正确运行ShellWait函数?我关心使用双引号。布尔参数应该能够更改为false。我不是每天都使用VBA,所以如果可以,我会问一个例子。
Sub ShellWait(fName As String, Optional showWindow As Boolean = True)
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
wsh.Run fName, -showWindow, True
End Sub
Private Sub Document_close()
ShellWait "cmd /c echo ^<meta http-equiv="x-ua-compatible" content="IE=10"^> && echo '"hello"' "
' ^the above code does not work
ShellWait "cmd /c echo '"hello"' "
' ^the above code does not work, syntax error
ShellWait (cmd /c echo '"hello"')
' ^the above code does not work, syntax error
End Sub
您可以使用以下内容
ShellWait "cmd /K echo ^<meta http-equiv=""x-ua-compatible"" content=""IE=10""^> && echo '""hello""' "