下面这段函数运行的时候出现 438错误和 1004错误,请帮忙看下,谢谢。
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