- ©«¤l
- 561
- ¥DÃD
- 160
- ºëµØ
- 0
- ¿n¤À
- 725
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDOWS
- ³nÅ骩¥»
- xp
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2014-9-10
- ³Ì«áµn¿ý
- 2024-8-7
|
DEAR ALL ¤j¤j
1.¦p¹Ï¤@¤º®e.½Ð±Ð°ÝÃD¦p¤U-
1.1 ìµ{¦¡¿ï¨úC:\AAA\¤U²Å¦X§ï¦WªºÀɮקï¦W«á©ñ¨ìRename¸ê®Æ§¨¤º.ìC:\AAA\¤UÀɮפ£ÅÜ.
1.2»Ý¨D
C:\AAA\¤U²Å¦X§ï¦WªºÀɮקï¦W«á©ñ¨ìRename¸ê®Æ§¨¤º,µM«á²¾°£C:\AAA\§ï¦W¦¨¥\ªºÀÉ®×,
¦ÓC:\AAA\¥¼¦¨¥\©Î«D¦¹ÅÞ¿è©Êªº¤ºªºÀÉ®×Ä~Äò«O¯d¡C
2.½Ð±Ð¦p¦óקïµ{¦¡.·Ð¤£§[½ç±Ð THANKS*10000
¹Ï¤@
Sub test2()
Dim i As Integer
Dim FolderPath, original_file, rename_file As String
'¿ï¾Ü¨Ó·½Àɮ׸ê®Æ§¨
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "¿ï¾ÜÀɮרӷ½¸ê®Æ§¨"
.Show
FolderPath = .SelectedItems(1) & "\"
Debug.Print FolderPath
End With
'²MªÅEXCEL
If Worksheets(2).Range("A2") <> "" Then Worksheets(2).Range("A2:B" & Worksheets(2).Range("A65536").End(xlUp).Row) = "" '§PÂ_¬O§_¦³¿ï¾Ü¨Ó·½¸ê®Æ§¨
If FolderPath <> "" Then
original_file = Dir(FolderPath & "*.*")
i = 1
Do Until original_file = ""
i = i + 1
Worksheets(2).Cells(i, 1) = original_file
original_file = Dir
Loop
'¸ê®Æ§¨¤£¦s¦b«h·s«Ø
If Dir(FolderPath & "\Rename", vbDirectory) = "" Then MkDir FolderPath & "\Rename"
For i = 2 To Sheet2.Range("A65536").End(xlUp).Row
'קï²Ä¤K½X
If Left(Worksheets(2).Range("A" & i), 12) Like "*" & "-" And Mid(Worksheets(2).Range("A" & i), 13, 3) = Sheet1.Cells(3, 4) Then
rename_file = Mid(Worksheets(2).Range("A" & i), 1, 12) & Sheet1.Cells(3, 5) & Mid((Worksheets(2).Range("A" & i)), 16)
Worksheets(2).Range("B" & i) = rename_file
Call FileSystem.FileCopy(FolderPath & Worksheets(2).Range("A" & i), FolderPath & "\Rename\" & rename_file)
End If
Next
Call CreateObject("WScript.Shell").Popup("§ó¦W§¹¦¨¡C", 1, "¨t²Î°T®§")
'¶}±Òµ²ªG¸ô®|
ActiveWorkbook.FollowHyperlink Address:=FolderPath + "\Rename\", NewWindow:=True
End If
End Sub |
|