Public Sub test()
Dim path As String
path1 = "C:\File Folder\File Test.pdf"
path2 = "C:\FileFolder\FileTest.pdf"
Shell "C:\Program Files (x86)\Nuance\PDF Professional 8\bin\GaaihoDoc.exe " & path1, vbNormalFocus
End Sub
由于path2
变量中的空格,如果使用path1
变量而不是path1
,则VBA中的上述代码有效。如何修复以运行变量path1
?
答案 0 :(得分:0)
带空格的路径需要引用双引号。 通过将它们加倍来逃避报价:
path1 = "C:\File Folder\File Test.pdf"
Shell """C:\Program Files (x86)\Nuance\PDF Professional 8\bin\GaaihoDoc.exe"" """ & path1 & """", vbNormalFocus