|
参与一下。。。- Sub test()
- Dim filename As String
- Dim currentdate As String
- Dim path, name As String
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set Fso = CreateObject("Scripting.FileSystemObject")
- Set d = CreateObject("Scripting.Dictionary")
- Sheet1.Copy
- Set wb = ActiveWorkbook
- currentdate = Format(Now(), "YYYYMMDD")
- path = CreateObject("Wscript.Shell").SpecialFolders("Desktop")
- For Each f In Fso.GetFolder(path).Files
- If f.name Like "*.xls*" Then
- fn = Fso.GetBaseName(f)
- fn1 = Left(fn, Len(fn) - 3)
- d(fn1) = Val(Right(fn, 2))
- End If
- Next f
- name = "采购单" & currentdate
- If Not d.exists(name) Then
- st = "01"
- Else
- m = d(name)
- st = Format(m + 1, "00")
- End If
- wb.SaveAs path & "" & name & "-" & st
- wb.Close
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|