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

½Ð°Ý¦p¦ó¨C¤ëVBA³Ð«Ø¸ê®Æ§¨

½Ð°Ý¦p¦ó¨C¤ëVBA³Ð«Ø¸ê®Æ§¨

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-7-27 09:09 ½s¿è

¤p§Ì¤£¤~·Q¦Û¦æ»s§@°]°È³øªí¡A¨ä¤º®e¥]¬A¤é³øªí¡B©P³øªí¡B¤ë³øªí
·Q½Ð¦U¦ì¤j¤jÀ°¦£¸Ñ¨Mªº°ÝÃD¦p¤U¡G
1.§Q¥ÎVBA©ó¨C¤ë¤ëªì¶}±Ò°]³øÀɮ׮ɦ۰ʳЫؤ@­Ó¥H¤ë¥÷¬°¸ê®Æ§¨¦WºÙ¤§¸ê®Æ§¨
2.¸ê®Æ§¨¨C¤ë©T©w©ó¤ëªì³Ð«Ø¤@¦¸¡A¤º§t¤p§Ì©Ò»s§@ªº¤é³øªí¡B©P³øªí¡B¤ë³øªí¤§ªÅ¥Õªí³æ
3.¨C¤ë©Ò»s§@ªº°]³ø°O¿ý¦Û°ÊÀx¦s©ó¸Ó¤ë¸ê®Æ§¨¤¤
4.¦]°]³ø¬°³sÄò©Ê¤å¥ó¡A¦]¦¹¶·©ó¨C¤ë¤ëªì¸ê®Æ§¨³Ð«Ø®É¡A¦Û°Ê¨ê·s§R°£ªí®æ°O¿ý¤§¸ê®Æ

­Y¦³¤j¤j¯àÀ°¦£¸Ñ¨M¤W­z¤§°ÝÃD¡A¤p§Ì·P¿E¸U¤À!!
§A²q!!

¦^´_ 1# bear0925900003
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. '***ªí³æ½d¥».xls (ªÅ¥Õªí³æªº¬¡­¶Ã¯)-> ¦]°]³ø¬°³sÄò©Ê¤å¥ó¡A¦]¦¹¶·©ó¨C¤ë¤ëªì¸ê®Æ§¨³Ð«Ø®É¡A¦Û°Ê¨ê·s§R°£ªí®æ°O¿ý¤§¸ê®Æ
  3. Const ªí³æ¸ê®Æ§¨ = "D:\"        '½Ð»s§@  **** D:\ªí³æ½d¥».xls (ªÅ¥Õªí³æ) *********
  4. Const ªí³æ¦WºÙ = "³øªí³æ.xls"   '¤ë³øªí¬¡­¶Ã¯¦WºÙ
  5. Sub Auto_Open() '¤@¯ë¼Ò²Õ(Module1) ¶}±ÒÀɮצ۰ʰõ¦æªºµ{§Ç
  6.     Dim Fs As Object, xlMonth As String
  7.     xlMonth = ªí³æ¸ê®Æ§¨ & Format(Date, "YYYYMMDD °]°È³øªí")    '¨C¤ëªº¸ê®Æ§¨
  8.     If Dir(xlMonth, vbDirectory) = "" Then MkDir (xlMonth) 'vbDirectory 16 °£µLÄݩʪºÀÉ®×¥~¡A¥t«ü©w¸ô®|©ÎÀɮק¨¡C
  9.     Set Fs = CreateObject("Scripting.FileSystemObject").GetFile(ªí³æ¸ê®Æ§¨ & "\ªí³æ½d¥».xls")
  10.     If Dir(xlMonth & "\" & ªí³æ¦WºÙ) = "" Then Fs.Copy xlMonth & "\" & ªí³æ¦WºÙ          '½Æ»sªí³æ½d¥»(ªÅ¥Õªí³æ) §ï¦W¬° "³øªí³æ.xls"
  11. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

½Ð°Ý¤j¤jConst ªí³æ¸ê®Æ§¨ = "D:\"¬OÄÝ©ó¹w³]Àx¦s¸ô®|
¦p¦ó§âConst ªí³æ¸ê®Æ§¨«ü©w¦bA1Àx¦s®æ¡AÅýÀx¦s®æ¦b¿é¤J¸ô®|«á¥i¥H§ïÅÜÀx¦s¸ô®|
§A²q!!

TOP

¦^´_ 3# bear0925900003
½Ð±N§AªºÀɮפW¶Ç¡A¥H¤è«K¸ÑÃDªÌ¤§¸àÄÀ¡A
ÁÂÁ¡C

TOP

¥i§_±NGBKEE¤j¤j©ó¥»½g´£¥Xªºµ{¦¡½Xµy§@­×§ï¡A±ø¥ó¦p¤U
Option Explicit
'***ªí³æ½d¥».xls (ªÅ¥Õªí³æªº¬¡­¶Ã¯)-> ¦]°]³ø¬°³sÄò©Ê¤å¥ó¡A¦]¦¹¶·©ó¨C¤ë¤ëªì¸ê®Æ§¨³Ð«Ø®É¡A¦Û°Ê¨ê·s§R°£ªí®æ°O¿ý¤§¸ê®Æ
Const ªí³æ¸ê®Æ§¨ = "D:\"        '¡ö "D:\" ¥i§_«ü©wÀx¦s®æ¤º®e(¦bÀx¦s®æ¤º¿é¤J¸ô®|)
Const ªí³æ¦WºÙ = "³øªí³æ.xls"   
Sub Auto_Open()
    Dim Fs As Object, xlMonth As String
    xlMonth = ªí³æ¸ê®Æ§¨ & Format(Date, "YYYY¦~MM¤ë°]°È³øªí")   '¡ö¦p¦ó¨Ï¤é´ÁÅã¥Ü©¹«e¤@­Ó¤ë¡A¨Ò¦p¥»¤ë¬°2016¦~12¤ëÅã¥Ü¬°2016¦~11¤ë
    If Dir(xlMonth, vbDirectory) = "" Then MkDir (xlMonth)
    Set Fs = CreateObject("Scripting.FileSystemObject").GetFile(ªí³æ¸ê®Æ§¨ & "\ªí³æ½d¥».xls")
    If Dir(xlMonth & "\" & ªí³æ¦WºÙ) = "" Then Fs.Copy xlMonth & "\" & ªí³æ¦WºÙ         
End Sub
§A²q!!

TOP

¦^´_ 5# bear0925900003
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. '***ªí³æ½d¥».xls (ªÅ¥Õªí³æªº¬¡­¶Ã¯)-> ¦]°]³ø¬°³sÄò©Ê¤å¥ó¡A¦]¦¹¶·©ó¨C¤ë¤ëªì¸ê®Æ§¨³Ð«Ø®É¡A¦Û°Ê¨ê·s§R°£ªí®æ°O¿ý¤§¸ê®Æ
  3. 'Const ªí³æ¸ê®Æ§¨ = "D:\"        '¡ö "D:\" ¥i§_«ü©wÀx¦s®æ¤º®e(¦bÀx¦s®æ¤º¿é¤J¸ô®|)
  4. 'Const ªí³æ¦WºÙ = "³øªí³æ.xls"
  5. Sub Auto_Open()
  6.     Dim Fs As Object, xlMonth As String, ªí³æ¸ê®Æ§¨ As String, ªí³æ¦WºÙ As String
  7.     ªí³æ¸ê®Æ§¨ = ActiveSheet.Range("A1")   ' ¤]¥i¥H«ü©w **ªí³æ¸ê®Æ§¨ = Sheets("Sheet1").Range("A1")
  8.     ªí³æ¦WºÙ = ActiveSheet.Range("A2") '      ¤]¥i¥H«ü©w **ªí³æ¦WºÙ = Sheets("Sheet1").Range("A2")
  9.     xlMonth = ªí³æ¸ê®Æ§¨ & Format(Date, "YYYY¦~MM¤ë°]°È³øªí")   '¡ö¦p¦ó¨Ï¤é´ÁÅã¥Ü©¹«e¤@­Ó¤ë¡A¨Ò¦p¥»¤ë¬°2016¦~12¤ëÅã¥Ü¬°2016¦~11¤ë
  10.     If Dir(xlMonth, vbDirectory) = "" Then MkDir (xlMonth)
  11.     Set Fs = CreateObject("Scripting.FileSystemObject").GetFile(ªí³æ¸ê®Æ§¨ & "\" & ªí³æ¦WºÙ)
  12.     If Dir(xlMonth & "\" & ªí³æ¦WºÙ) = "" Then Fs.Copy xlMonth & "\" & ªí³æ¦WºÙ
  13. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

GBKEE¤j©p¯u¬O¯«¤H¡A¦³¦Ò¼{¶}¯Z±Â½Ò¶Ü?§Ú³ø¦W
§A²q!!

TOP

¦^´_ 7# bear0925900003
§Ú¬O´¶³q¤H¦Ó¤w,¥u¬O±M¬ãVBA¤ñ§A¦h¤@¨Çªº®É¶¡§a,
¶}½Ò¬O§Aªº®¥ºû¸Ü,¾ÇÃÑ©|²L,¤£´±¶}½Ò.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¶¢¤HµL¼Ö½ì¡A¦£¤HµL¬O«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD