|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 暮牧 于 2018-9-8 09:34 编辑
目前已经能实现一起打印了。问题是有的机子配置比较好,有的机子配置比较,配置差的机子调取PDF的时候会出现打印顺序错误。如图,如何实现在不同的机子都能正确的打印,并且时间最短。
- Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
- Private Sub CommandButton1_Click()
- For n = 1 To 5 Step 1
- Sheets(Array("Sheet1", "Sheet3")).Select
- Sheets("Sheet3").Activate
- ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True '打印Sheet1、Sheet2
- ShellExecute 0&, "print", ThisWorkbook.Path & "\1.PDF", vbNullString, vbNullString, 0
- ShellExecute 0&, "print", ThisWorkbook.Path & "\2.PDF", vbNullString, vbNullString, 0
- ShellExecute 0&, "print", ThisWorkbook.Path & "\3.PDF", vbNullString, vbNullString, 0
- ShellExecute 0&, "print", ThisWorkbook.Path & "\4.PDF", vbNullString, vbNullString, 0
- ShellExecute 0&, "print", ThisWorkbook.Path & "\5.PDF", vbNullString, vbNullString, 0
- ShellExecute 0&, "print", ThisWorkbook.Path & "\6.PDF", vbNullString, vbNullString, 0
- Application.Wait Now + TimeValue("00:00:03") '时间延迟3秒,有的机子测试可以有的不行,加载的时间有长有短,如何
- 'MsgBox "我执行了第" & n & "遍"
- Next
- Sheets("Sheet2").Select
- End Sub
复制代码
|
-
错误的顺序
-
正确的顺序
-
-
测试.7z
1.61 MB, 下载次数: 1
测试表格
|