...EXCEL工作簿,找出同名的例如每个工作簿中Sheet2这张工作表全部打印出...
发布网友
发布时间:2024-09-30 11:24
我来回答
共1个回答
热心网友
时间:2024-11-10 15:44
修改为:
Sub prt()
Dim ws As Workbook, path$, d$
Application.ScreenUpdating = False
path = ThisWorkbook.path & "\"
d = Dir(path & "*.xls")
Do While d <> ""
If d <> ThisWorkbook.Name Then
Set ws = Workbooks.Open(path & d)
ws.Sheets("sheet2").PrintOut
ws.Close False
End If
d = Dir
Loop
Application.ScreenUpdating = True
End Sub