ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð°Ýexcel¥i¥H±N·Q­nÀÉ®×¥þ³£²¾°Ê½Æ»s¨ì©T©w¸ê®Æ§¨¤º¶Ü?

[µo°Ý] ½Ð°Ýexcel¥i¥H±N·Q­nÀÉ®×¥þ³£²¾°Ê½Æ»s¨ì©T©w¸ê®Æ§¨¤º¶Ü?

¦]¬°¹ÏÀÉ«D±`¦h,©Ò¥H·Q§Q¥Îexcel§âpdfÀɳ£§ì¥X¨Ó,³Ì«á¦A¥Îpdf¦X¨Ö¦¨¤@­ÓÀÉ®×,§Æ±æ¦³¤j¤j¥i¥H¸Ñµª,·PÁÂ^^

¥»©«³Ì«á¥Ñ 882138 ©ó 2016-1-14 11:01 ½s¿è

ª©¤j§A¦n~§Ú¦b±z³¡¸¨®æ¦³µo²{¦³Ãþ¦üªºvba,ÀɮצWºÙ¥i¥H§ó§ï¦¨§Ú¿é¤JªºÀɮצWºÙ¶Ü?¦Ó¤£¬O´M§ä¥þ³¡Àɮתº
  1. Sub ½Æ»sÀÉ®×()
  2. Dim y&, MyPath, uPath, CCPath$, xR As Range, uChk1, uChk2
  3. Dim Obj, FName1$, FName2$, FL1, FL2, Date1 As Date, Date2 As Date
  4. y = Cells(Rows.Count, "C").End(xlUp).Row
  5. If y < 8 Then MsgBox "µLÀɮשú²Ó¡A½Ð¥ý°õ¦æ¡e¸ü¤JÀɮסf!": Exit Sub
  6. MyPath = [B1]: If MyPath = "MyPath" Then MyPath = ThisWorkbook.Path
  7. If Right(MyPath, 1) <> "\" Then MyPath = MyPath & "\"
  8. uPath = [D1]: If Right(uPath, 1) <> "\" Then uPath = uPath & "\"
  9. If Dir(uPath, vbDirectory) = "" Then MsgBox "§ä¤£¨ì¡e¥Øªº¸ô®|¡G" & uPath & "¡f¡@": Exit Sub
  10. uChk1 = ActiveSheet.CheckBoxes("¿ï¶µ1").Value
  11. uChk2 = ActiveSheet.CheckBoxes("¿ï¶µ2").Value
  12. '-------------------------------------
  13. Set Obj = CreateObject("Scripting.FileSystemObject")
  14. Range("E7:E" & y).ClearContents
  15. For Each xR In Range("C7:C" & y)
  16.     If xR = "" Then
  17.        If uChk1 = xlOn Then
  18.           CCPath = Replace(xR(1, 2) & "\", MyPath, uPath)
  19.           If Dir(CCPath, vbDirectory) = "" Then MkDir CCPath
  20.           xR(1, 3) = "¡¹"
  21.        End If
  22.        GoTo 101
  23.     End If
  24.     '---------------------------
  25.     CCPath = uPath
  26.     If uChk1 = xlOn Then CCPath = Replace(xR(1, 2), MyPath, uPath)
  27.     FName1 = xR(1, 2) & xR(1, 0):   FName2 = CCPath & xR(1, 0)
  28.     If uChk2 = xlOn And Dir(FName2) <> "" Then
  29.        Date1 = Obj.GetFile(FName1).DateLastModified '­×§ï¤é´Á (DateCreated '«Ø¥ß¤é´Á)
  30.        Date2 = Obj.GetFile(FName2).DateLastModified
  31.        If Date1 <= Date2 Then xR(1, 3) = "...": GoTo 101
  32.     End If
  33.     FileCopy FName1, FName2
  34.     xR(1, 3) = "¤w½Æ»s"
  35. 101: Next
  36. Dir ("PP"): Beep
  37. End Sub
½Æ»s¥N½X
20140928v01(½Æ»s¸ê®Æ§¨ÀÉ®×).rar (23.36 KB)

TOP

Sub TEST()
Dim xR As Range, FS, xFile$
Set FS = CreateObject("Scripting.FileSystemObject")
For Each xR In Range([A1], [A65536].End(xlUp))
¡@¡@If xR <> "" Then
¡@¡@¡@¡@xFile = "D:\123\" & xR & "*.pdf"
¡@¡@¡@¡@If Dir(xFile) <> "" Then FS.CopyFile xFile, "D:\456\"
¡@¡@End If
Next
End Sub

TOP

¦^´_ 3# ­ã´£³¡ªL

ÁÂÁª©¤jµL¨p¤À¨É,ª©¤j¤Ó¯«¤F!!

TOP

        ÀR«ä¦Û¦b : ¥Í®ð¡A´N¬O®³§O¤Hªº¹L¿ù¨ÓÃg»@¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD