- ©«¤l
- 913
- ¥DÃD
- 150
- ºëµØ
- 0
- ¿n¤À
- 1089
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- office 2019
- ¾\ŪÅv
- 50
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2011-8-28
- ³Ì«áµn¿ý
- 2023-7-19
|
¦^´_ 4# GBKEE
G¤j,
¤£¦n·N«ä,¦]¬°§Ú¬Ý¹Lªºµ{¦¡½X¹ê¦b¤£¦h,¤]²Ä¤@¦¸¬Ý¨ì³oºØ¼gªk,Åý§Ú¤£ª¾¦p¦ó®M¤J§Ú»Ýnªºµ{¦¡,¤w¸g¦h¦¸¹Á¸Õ¦UºØ²Õ¦X,¦ý¨S¦³¤@¦¸¥i¥Hrun§¹³oÓµ{¦¡,¥¦¨Ï²×³£¥d¦b¸ô®|³o¤@Ãö,´NµLªk°õ¦æ¤F,¥i¥H³Ò·ÐGÀ°¦£¬Ý¤U¶Ü?- Option Explicit
- Dim sf As Object
- Sub Ex()
- Set sf = CreateObject("Scripting.FileSystemObject")
- Ex_SubFolder "W:\Ī¦Ë¦@¥Î\ÜÀx¦@¥Î\1_²z³f.®w¦s\1.¤é¯Z²z³f´«ºâªí\*5¤ë*.xlsx" '**©I¥sµ{¦¡ °Ñ¼Æ¬° «ü©wªº¸ê®Æ§¨
- End Sub
- Sub Ex_SubFolder(xFolder As String) '**°Ñ¼Æ¬°¤å¦r
- Dim xSub As Object, E As Variant
- Set xSub = sf.GetFolder(xFolder).SubFolders
- xSub "W:\Ī¦Ë¦@¥Î\ÜÀx¦@¥Î\1_²z³f.®w¦s\1.¤é¯Z²z³f´«ºâªí\*5¤ë*.xlsx"
- '**SubFolders : ¶Ç¦^¥]§t©Ò¦³¸ê®Æ§¨ªº¤@Ó Folders ¶°¦Xª«¥ó
- For Each E In xSub
- Ex_xFiles E '**©I¥sµ{¦¡ ¶Ç»¼°Ñ¼Æ Folder ª«¥ó
- '**¶Ç»¼¤U¤@¼hªº¸ê®Æ§¨***
- Ex_SubFolder E.Path '**©I¥sµ{¦¡ ¶Ç»¼°Ñ¼Æ SubFolders ¶°¦Xª«¥ó
- Next
- End Sub
- Sub Ex_xFiles(xF As Variant) '**°Ñ¼Æ¬°¤å¦r
- Dim E As Variant
- Dim a
- a = Format(Date, "yyyymmdd") '·í¤é
- Debug.Print a
- For Each E In xF.Files '**Files ¶°¦Xª«¥ó : ¸ê®Æ§¨¤ºªº©Ò¦³ File ª«¥óªº¶°¦Xª«¥ó
- Debug.Print E.SHORTPATH = "W:\0_¦Ûqªí³æ\Backup\" & "*" & a & "*\" '** E.SHORTPATH : Àɮתº§¹¾ã¸ô®|¦WºÙ
- '**¦b³o¸Ì®M¤J§A©Ò»Ýªºµ{¦¡½X
- sf.CopyFile SubFolders, xFiles
- Set sf = Nothing
- '************
- Next
- End Sub
½Æ»s¥N½X ¥t¥~ì¥ýªº³oÓµ{¦¡,¹ï§Ú¨Ó»¡¨ä¹ê¬O¤ñ¸û²LÅã©öÀ´ªº,¥i§_¤]¦P®É½Ð±Ð:
1. ³oÓµ{¦¡ªº¸ô®|¥Î©T©w¦¡ªº¼gªk,¥i¥H«D±`§Ö³tªºcopyÀɮרì«ü©w¸ô®|
2. ·í¥Øªº¸ô®|¬°¦~¤ë¤é¬°Åܰʸê®Æ§¨®É,«oµLªkcopy
3. ½Ð°Ý³oÓ¼gªkÁÙ¦³±Ï¶Ü?¥i¥Hµy¥[קï¥Øªº¸ê®Æ§¨¬°¦~¤ë¤éÅܰʦ¡ªº¶Ü?
4. §Ú¤@¦¸·Q³Æ¥÷¦hÓ¨Ó·½¤£¦Pªº¸ê®Æ§¨,¨ì¦hÓ¤£¦P¥Øªº¸ê®Æ§¨,¬O§_¥i¥H¦@¥ÎDim fso As Object, souf$, desf$, P$, aªº«Å§i?³o¼Ëµ{¦¡·|²V²c¦ÓµLªk½Æ»s¸ê®Æ¶Ü?- Sub autocopy()
- Dim fso As Object, souf$, desf$, P$, a
- a = Format(Date, "yyyymmdd") '¥»¤ë·í¤é
- Debug.Print a
- Path = "W:\0_¦Ûqªí³æ\Backup\"
- P = Path & "*" & a & "*" & "\" '¥Øªº¸ô®|¬°¦~¤ë¤é¬°Åܰʸê®Æ§¨®É,µLªkcopy
- Set fso = CreateObject("Scripting.FilesyStemObject") '©w¸qfso¬°ª«¥ó
- souf = "W:\Ī¦Ë¦@¥Î\ÜÀx¦@¥Î\1_²z³f.®w¦s\1.¤é¯Z²z³f´«ºâªí\*5¤ë*.xlsx"
- desf = P '¥Øªº¸ô®|¬°¦~¤ë¤é¬°Åܰʸê®Æ§¨®É,µLªkcopy
- fso.CopyFile souf, desf
- Set fso = Nothing
- End Sub
½Æ»s¥N½X |
|