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

[µo°Ý] Ū¨ú³Ì·sÀɮפº¸ê®Æ

[µo°Ý] Ū¨ú³Ì·sÀɮפº¸ê®Æ

³Ì·sÀɮצs¦bA¸ô®|¤º

³o­Ó³Ì·sÀɮײ£¥Í±ø¥ó¬°¨C¤é©w®É²£¥Í

¨Ò¦p:2014-11-08 000846.xls
³o¼Ë¤U¤@­Ó¦¸²£¥ÍÀɮ׬°  2014-11-08 000946.xls

§Ú­nŪ¨ú³Ì·sÀɮפº¸ê®Æ  ½Ð°Ý§Ú¸Ó«ç³Â°µ·|¤ñ¸û¦n

¦^´_ 1# taiwan
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim xDir As String, i As Integer, Ay(), Ar(), s As Variant
  4.     Dim xPath As String
  5.     xPath = "A:\"
  6.     xDir = Dir(xPath & Format(Date, "yyyy-mm-dd") & "*.xls", vbDirectory)
  7.     'Dir: ªí¥Ü¦X¥G±ø¥ó¡BÀÉ®×ÄÝ©Ê¡BºÏºÐ¼Ð°Oªº¤@­ÓÀɮצWºÙ¡B©Î¥Ø¿ý¡BÀɮק¨¦WºÙ¡C
  8.     If xDir = "" Then MsgBox "¨S¦³³Ì·sÀÉ®×": Exit Sub
  9.     Do While xDir <> ""
  10.         ReDim Preserve Ar(0 To i)   '°}¦C:«O«ù­ì¦³¤¸¯À,­«·s°t¸m°ÊºA°}¦CÅܼƪºÀx¦sªÅ¶¡¡C
  11.         ReDim Preserve Ay(0 To i)
  12.         Ar(i) = xDir
  13.         Ay(i) = Val(Replace(Split(xDir, " ")(1), ".xls", "")) '¨ú±o¼Æ¦r
  14.         i = i + 1
  15.         xDir = Dir                  '¤U¤@­Ó ¦X¥G±ø¥óªºÀÉ®×
  16.     Loop
  17.     s = Application.Max(Ay)
  18.     s = Application.Match(s, Ay, 0)
  19.     If MsgBox("¶}±Ò³Ì·s  ÀÉ®× " & vbTab & Ar(s - 1) & vbLf & Join(Ar, vbLf), vbYesNo) = vbYes Then
  20.         Workbooks.Open xPath & Ar(s - 1)
  21.     End If
  22. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  taiwan
¸Õ¸Õ¬Ý
GBKEE µoªí©ó 2014-11-8 16:27



¥H¤U¦³ÂI¬Ý¤£¤ÓÀ´

Ay(i) = Val(Replace(Split(xDir, " ")(1), ".xls", "")) '¨ú±o¼Æ¦r


loop

s = Application.Max(Ay)

    s = Application.Match(s, Ay, 0)

    If MsgBox("¶}±Ò³Ì·s  ÀÉ®× " & vbTab & Ar(s - 1) & vbLf & Join(Ar, vbLf), vbYesNo) = vbYes Then

        Workbooks.Open xPath & Ar(s - 1)

³Â·Ð¤j¤j

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-11-8 19:17 ½s¿è

¦^´_ 4# taiwan
¦³ÂI¬Ý¤£¤ÓÀ´
ºCºC¨Ó,¤£À´ªº¨ç¼Æ,¤èªk ¥i¹î¬Ývbaªº»¡©ú

DIR ·|¨ÌÀɮצWºÙ»¼¼W¨Ó±Æ§Ç
2#ªºµ{¦¡½X¥i­×§ï¤@¤U
  1. Option Explicit
  2. Sub Ex()
  3.     Dim xPath As String, xDir As String, S As String
  4.     xPath = "A:\"
  5.     xDir = Dir(xPath & Format(Date, "yyyy-mm-dd") & "*.xls", vbDirectory)
  6.     'Dir: ªí¥Ü¦X¥G±ø¥ó¡BÀÉ®×ÄÝ©Ê¡BºÏºÐ¼Ð°Oªº¤@­ÓÀɮצWºÙ¡B©Î¥Ø¿ý¡BÀɮק¨¦WºÙ¡C
  7.     If xDir = "" Then MsgBox "¨S¦³³Ì·sÀÉ®×": Exit Sub
  8.     Do While xDir <> ""
  9.         S = xDir
  10.         xDir = Dir                  '¤U¤@­Ó ¦X¥G±ø¥óªºÀÉ®×
  11.     Loop
  12.     If MsgBox("¶}±Ò³Ì·s  ÀÉ®× " & vbTab & S, vbYesNo) = vbYes Then
  13.         Workbooks.Open xPath & S
  14.     End If
  15. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  taiwan
¦³ÂI¬Ý¤£¤ÓÀ´
ºCºC¨Ó,¤£À´ªº¨ç¼Æ,¤èªk ¥i¹î¬Ývbaªº»¡©ú

DIR ·|¨ÌÀɮצWºÙ»¼¼W¨Ó±Æ§Ç
2 ...
GBKEE µoªí©ó 2014-11-8 19:04


For GBKEE:

¥H¤U³o¬q¬O¥Î§A¤À¨Éªº»yªk§ïªº  ·PÁ§A

§Ú¤]§â´ú¸Õ¦¨¥\ªº»yªk¤À¨Éµ¹¤j®a
  1. Sample
  2. Sub data()

  3.     Dim xPath, xDir, overdata As String
  4.     Dim best As Long

  5.    

  6.     xPath = "A:\¸ô³w\"
  7.    
  8.     'Dir: ªí¥Ü¦X¥G±ø¥ó¡BÀÉ®×ÄÝ©Ê¡BºÏºÐ¼Ð°Oªº¤@­ÓÀɮצWºÙ¡B©Î¥Ø¿ý¡BÀɮק¨¦WºÙ¡C
  9.     xDir = Dir(xPath & "WIP_Status_" & Format(Date, "yyyy-mm-dd") & "-" & "*.xls", vbDirectory)
  10.    
  11.       best = 0
  12.         Do While xDir <> ""

  13.             If Val(Mid(xDir, 23, 6)) > best Then

  14.                 best = Val(Mid(xDir, 23, 6))
  15.                 overdata = xDir                                      
  16.                     End If

  17.             xDir = Dir()
  18.             
  19.                 i = i + 1
  20.                
  21.             Loop
  22.             
  23.         Workbooks.Open xPath & overdata
  24.         

  25.    
  26. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : µoµÊ®ð¬Oµu¼ÈªºµoºÆ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD