VBA执行';无与伦比';并打开两个文件

VBA执行';无与伦比';并打开两个文件,vba,excel,compare,Vba,Excel,Compare,我正在创建一个程序来比较两个文件,使用program by shell命令。但是,我只能打开一个文件。我希望两个文件一起执行 以下是我使用的代码: Dim Path As String Dim File1 As String Dim File2 As String '[Codes for Other Conditions] '... If Test <> "" Then 'Test Variable will trigger opening beyond compare a

我正在创建一个程序来比较两个文件,使用program by shell命令。但是,我只能打开一个文件。我希望两个文件一起执行

以下是我使用的代码:

Dim Path As String
Dim File1 As String
Dim File2 As String

'[Codes for Other Conditions]
'...

If Test <> "" Then 
  'Test Variable will trigger opening beyond compare and compares
  'File1 (on right side) and File2 (Left Side)
    Path = Shell("C:\Temp\" + " " + File1  + " " + File2, vbNormalFocus)
end If
Dim路径作为字符串
将文件1设置为字符串
将文件2设置为字符串
“[其他条件的代码]
'...
如果测试“”则
'测试变量将触发超出比较和比较的打开
'文件1(右侧)和文件2(左侧)
Path=Shell(“C:\Temp\”+“”+File1+“”+File2,vbNormalFocus)
如果结束

提前谢谢你

您不需要在shell命令中指定Beyond Compare可执行文件名吗?例如,如果程序文件为bc.exe且位于C:\beyond中,则需要指定Shell(“C:\beyond\bc.exe”&file1&&file2,vbNormalFocus)。还要注意的是,您需要在file1和file2中包含完整的路径名。不要忘记引用/转义您的文件名。否则,您将无法使用包含空格的文件名