| ©«¤l5923 ¥DÃD13 ºëµØ1 ¿n¤À5986 ÂI¦W0  §@·~¨t²Îwin10 ³nÅ骩¥»Office 2010 ¾\ŪÅv150 ©Ê§O¨k ¨Ó¦Û¥xÆW°ò¶© µù¥U®É¶¡2010-5-1 ³Ì«áµn¿ý2022-1-23 
         
 | 
                
| ¥»©«³Ì«á¥Ñ GBKEE ©ó 2017-9-9 09:33 ½s¿è 
 ¦^´_ 4# vm3503ru8
 .CommandType = 0 ¥L³£»¡©I¥s¤£¥¿½T
 ¨S¬Ý¨ìµ{¦¡,¤£¤F¸Ñ
 ½Æ»s¥N½XOption Explicit
Dim xPath As String
Sub Ex()
    xPath = "d:\" 'ThisWorkbook.Path
    Ex_×§ï³Ì·s¤å¦rÀÉ
    Workbooks.Open Latest_file(xPath)  '¶×¤JTXT¨ìEXCEL
End Sub
Sub Ex_×§ï³Ì·s¤å¦rÀÉ()
    Dim xFile As String, F As Object,  i As Integer
    Dim My(), myRow As Integer
    xFile = Latest_file(xPath)  'Latest_file¨ç¼Æ(Function) ,¶Ç¦^:³Ì·s¦sÀɪºÀɮצWºÙ
    Open xFile For Input As #1
    Do Until EOF(1)
        ReDim Preserve My(0 To myRow)
        Input #1, My(myRow) ', my(1), my(2), my(3), my(4), my(5), my(6)
        myRow = myRow + 1
    Loop
    Close #1
    Set F = CreateObject("Scripting.FileSystemObject").CreateTextFile(xFile, True) '¶}±Ò¤å¥óÀÉ,¥iÂл\ì¤å¥óÀɼҦ¡
    For i = 0 To UBound(My)
    F.Writeline My(i)
    Next
    F.Close
End Sub
Function Latest_file(¸ê®Æ§¨¸ô®| As String) As String    '¦Ûq¨ç¼Æ(Function) ,¶Ç¦^:³Ì·s¦sÀɪºÀɮצWºÙ
    Dim F As Object, E, AR(), i As Integer, A As Variant, xFile As String
    Set F = CreateObject("Scripting.FileSystemObject").GetFolder(¸ê®Æ§¨¸ô®|).Files
    ReDim AR(1 To 2, 1 To F.Count)
    For Each E In F
        If E Like "*.txt" Then     'ÀÉ®×°ÆÀɦW¬°txt
            i = i + 1
            AR(1, i) = E                        '°}¦C²Ä¤@ºû ¸m¤JÀɮצWºÙ
            AR(2, i) = CDbl(E.DateLastModified) '°}¦C²Ä¤Gºû ¸m¤J¦sÀɮɶ¡
        End If
    Next
    A = Application.WorksheetFunction.Index(AR, 2)
    On Error Resume Next
    Latest_file = AR(Application.Match(Application.Max(A), A, 0), 1)
    If Err Then MsgBox ¸ê®Æ§¨¸ô®| & "¸ê®Æ§¨,§ä¤£¨ì  txtÀÉ®× !!! ": End
End Function
 | 
 |