Sub ABCD() Dim lj As String Dim dirname As String Dim nm As String lj = ActiveWorkbook.Path nm = ActiveWorkbook.Name dirname = Dir(lj & "\*.xlsx") Do While dirname <> "" If dirname <> nm Then Workbooks.Open Filename:=lj & "\" & dirname Workbooks(dirname).save Workbooks(dirname).Close False End If dirname = Dir Loop End Sub
Sub dfdfdf() Application.DisplayAlerts = 0 aa = ThisWorkbook.Path kk = Dir(aa & "\*.xlsx") Do While kk <> "" If kk <> ThisWorkbook.Name Then Workbooks.Open Filename:=aa & "\" & kk ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\10220719\桌面\新建文件夹 (4)\" & kk ActiveWorkbook.Close False End If kk = Dir Loop Application.DisplayAlerts = 1 End Sub