我使用VB创建了以下批处理文件:
Open sBatchFile For Output As #1
Print #1, "@ECHO OFF"
Print #1, "ECHO Converting Excel Files to PDF, Please wait..."
Print #1, "batchpdf ""\\Tiltonsrv1\officeplantshared\Schedule_3.xls"" ""\\Tiltonsrv1\officeplantshared\SHIFT_SCHEDULES\"" &fileName& "
Close #1
i = Shell(sBatchFile, vbMaximizedFocus)
Application.Quit
End Sub
但是无法识别变量fileName。我是否正确地将其放入文件中?
答案 0 :(得分:3)
我想你想要:
Open sBatchFile For Output As #1
Print #1, "@ECHO OFF"
Print #1, "ECHO Converting Excel Files to PDF, Please wait..."
Print #1, "batchpdf ""\\Tiltonsrv1\officeplantshared\Schedule_3.xls"" ""\\Tiltonsrv1\officeplantshared\SHIFT_SCHEDULES\" & fileName & """ "
Close #1
i = Shell(sBatchFile, vbMaximizedFocus)
Application.Quit