我在excelvba相当新。我试图生成一个代码,允许发送pdf到打印机在一个序列。我开发了一个代码,但代码不理解序列(按名称排序)。我该如何纠正我的代码?
代码在这里
Sub Send_to_Printer_by_in_a_sequence()
Dim way As String, Pdfs As String
Application.ScreenUpdating = False
way = ThisWorkbook.Path & Application.PathSeparator
Pdfs = Dir(way & "*.pdf")
While Pdfs <> ""
CreateObject("Shell.Application").Namespace(0).ParseName(way & Pdfs).InvokeVerb ("Print")
Application.Wait Now + TimeSerial(0, 0, 4)
Pdfs = Dir
Wend
On Error GoTo 10
AppActivate "Acrobat Reader", True
SendKeys "%{F4}", True
Application.Wait Now + TimeSerial(0, 0, 3)
10 Application.ScreenUpdating = True
MsgBox "All pdfs has been sent to printer."
End Sub
1条答案
按热度按时间4nkexdtk1#
您可以收集您的pdf文件的名称,排序阵列,因为你喜欢和发送到打印机在任何序列挑选名称从阵列