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

[µo°Ý] ¦¹³B»Ý­n¤@­Óª«¥ó

[µo°Ý] ¦¹³B»Ý­n¤@­Óª«¥ó

¦U¦ì°ª¤â¦n¡G

1) §ÚªºVBA¬O©ñ¦bMacro.xlsm¤¤¡A·Q³]©w¤@­Ót­È,¨Ã¥B©ñ¦b"Macro.xlsm"ªºWorksheets("VBA").Range("B31")¤¤,
¨Ã¥B±Nt­È¥N¤J³o­Ó¸ô®|¸Ì Path = "D:\Ī¦Ë¦@¥Î\­ÜÀx¦@¥Î\1_²z³f.®w¦s\ºô¸ô­q³æ\" & "ºô¸ô­q³æ_" & xi & "\" & "ºô¸ô­q³æ_" & t & "\"
Àx¦s®æªº­È¬O¤@­Ó¤é´Áªºtext¡A¨Ò¦p¡G20190906¡A¥¦¬O¸ê®Æ§¨©R¦Wªº¤@³¡¥÷¡A§Ú±`±`·|»Ý­n§ä´X¤Ñ«eªº¸ê®Æ¡A¥i¥Hª½±µ¦bÀx¦s®æ¤¤­×§ï´N¤ñ¸û¤è«K¡A
¦ý¦b°õ¦æµ{¦¡®É,·|¥X²{¹ï¸Ü®Ø§iª¾,¦¹³B»Ý­n¤@­Óª«¥ó¡A§Ú²q·Q¬O§_ Dim  t As String³o­Ó«Å§i¿ù»~??ÁÙ¬O¦³¨ä¥¦°ÝÃD?

¥H¤U¬Oµ{¦¡ªº¤@³¡¥÷¡G
  1. Sub EX()
  2. Dim mFile As String, xmFile As String, rFile As String, ¥ØªºÀÉ As Workbook, ¨Ó·½ÀÉ As Workbook, m¨Ó·½ÀÉ As Workbook, PO¨Ó·½ As Workbook, xPO¨Ó·½ As Workbook, i As String, xi As String, t As String

  3. Application.Calculation = xlManual     '¤â°Ê­pºâ
  4. Application.ScreenUpdating = False
  5. xi = Format(Date, "YYYY.MM")  '¤é´Á¦~¤ë³]©w§@¬°¤u§@ªíªºÅܼÆ
  6. Set t = Workbooks(Workbooks("Macro.xlsm").Worksheets("VBA").Range("B31").Value) 'tÅܼƫü©wÀx¦s®æ¬°ÀɮצW
  7. '**********************¥ØªºÀɸê®Æ§¨ ²ÎÎëÅ禬(¦³¤½¦¡)
  8.     Path = "D:\0_¦Û­qªí³æ\D²ÎÎëÅ禬\"                '¥ØªºÀÉ
  9.     xmFile = Dir(Path & "*²ÎÎëÅ禬*.XLSX")            '¨Ó·½ÀɦW
  10.         Do While xmFile <> ""
  11.             Application.DisplayAlerts = False       '¤@¯ë´£Äµ¥Ü°T®§Ãö³¬
  12.             Workbooks.Open filename:=Path & xmFile
  13.         
  14.     Set ¥ØªºÀÉ = Workbooks(Dir(Path & "*²ÎÎëÅ禬*.XLSX"))
  15. '**********************¥ØªºÀÉ ²M°£¤§«e¶K¤Wªº¸ê®Æ....
  16.       ¥ØªºÀÉ.Activate
  17.         Range("­q³æ.¤ñµá¦h²ÎÎë").ClearContents
  18.         Range("¤ñµá¦hÅ禬").ClearContents
  19.         xmFile = Dir
  20.     Loop
  21. '**********************¶}±Ò­q³æ¸ê®Æ
  22. Path = "D:\Ī¦Ë¦@¥Î\­ÜÀx¦@¥Î\1_²z³f.®w¦s\ºô¸ô­q³æ\" & "ºô¸ô­q³æ_" & xi & "\" & "ºô¸ô­q³æ_" & t & "\"     '­q³æ¸ê®Æ§¨
  23.     mFile = Dir(Path & "*²ÎÎë*" & ".XLS")     '¨Ó·½ÀÉ
  24.         Do While mFile <> ""
  25.             Application.DisplayAlerts = False       '¤@¯ë´£Äµ¥Ü°T®§Ãö³¬
  26.             Workbooks.Open filename:=Path & mFile
½Æ»s¥N½X
2) §Ú¦³­ÓbatÀɥΨӦ۰ʳƥ÷ÀÉ®×,§Ú·Q§â¬õ¦â¦r§ï¬°¥i¥H¦Û°Ê±a¥X·í¦~¤Î·í¤ë,·í¦~«×¤Î¤ë¥÷§ïÅÜ®É,´N¤£¥Î¤â°Ê­×§ï,½Ð°Ý³o­ÓÅܼƭn«ç»ò¦bbat¤¤­×§ï?
a) 108¦~(¥xÆW¦~«×)¤Î¦è¤¸¦~(2019¦~)ªº¼gªk
b) ¦Û°Ê¨Ì¤ë¥÷ªºÅܼƼgªk¡A¨Ò¡G9¤ë¡B12¤ë.....

@echo off
set hour=%time: =0%
set File=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%
echo %File%
xcopy "D:\Ī¦Ë¦@¥Î\­ÜÀx¦@¥Î\1_²z³f.®w¦s\¤ñµá¦h\108¦~¤ñµá¦h\Ī¦Ë©Ò¹L¤¹¦¬¦^¼t³æ\*9¤ë.xlsx" "D:\0_¦Û­qªí³æ\Backup\­ÜÀx¦@¥Î%File%\¤ñµá¦h\" /D /Y

t As String  
Set t = Workbooks(Workbooks("Macro.xlsm").Worksheets("VBA").Range("B31").Value) 'tÅܼƫü©wÀx¦s®æ¬°ÀɮצW

t¬O¤å¦r«¬ºA, ¥Îset·íµM¤£¦æ

TOP

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

·PÁ¤j¤j´£¥Ü,

´«­Ó¤è¦¡¡A...²×©ó¸Ñ¨M°ÝÃD¤F¡I

t = Workbooks("Macro.xlsm").Worksheets("VBA").Range("B31").Value

¤£¹LÃö©óbatªºÅܼÆ,§ä¤F¦n¦h¸ê®Æ,¤j¦h¬O§â¦~¤ë¤é§ï¬°20190912 (¨Ò¥y)¡A¤ë¥÷³£·|±a¥X2½X,¦³¤Hª¾¹D­n«ç»ò§ï¬°¤ë¥÷¤Î¥xÆW¦~¶Ü¡H
´N¬O1~9¤ë¬O³æ¤@¼Æ¦r®É,«e­±¤£¸É0ªº¼gªk¡H
2019¦~§ï108¦~

@echo off
set hour=%time: =0%
set File=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%
echo %File%
xcopy "D:\Ī¦Ë¦@¥Î\­ÜÀx¦@¥Î\1_²z³f.®w¦s\¤ñµá¦h\108¦~¤ñµá¦h\Ī¦Ë©Ò¹L¤¹¦¬¦^¼t³æ\*9¤ë.xlsx" "D:\0_¦Û­qªí³æ\Backup\­ÜÀx¦@¥Î%File%\¤ñµá¦h\" /D /Y

TOP

        ÀR«ä¦Û¦b : ¯àµ½¥Î®É¶¡ªº¤H¡A¥²¯à´x´¤¦Û¤v§V¤Oªº¤è¦V¡C
ªð¦^¦Cªí ¤W¤@¥DÃD