|
本帖最后由 liulang0808 于 2023-2-8 13:32 编辑
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpszOp As String, _
ByVal lpszFile As String, ByVal lpszParams As String, _
ByVal LpszDir As String, ByVal FsShowCmd As Long) As Long
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Button1_Click()
Set fso = CreateObject("scripting.filesystemobject")
For Each f In fso.getfolder(ThisWorkbook.Path).Files
If InStr(f.Name, ThisWorkbook.Name) = 0 Then ShellExecute Application.hwnd, "print", f, "", "", SW_HIDE
Next f
End Sub
楼主测试下,看看是否可行吧
如果文件多,打印有问题,增加等待时间吧 |
|