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

[µo°Ý] »Ý­n¤@­Ó ¿ï¾ÜExcelÀɮתºµøµ¡ ¶i¦æ¿ï¾Ü µM«á¶}±Ò

[µo°Ý] »Ý­n¤@­Ó ¿ï¾ÜExcelÀɮתºµøµ¡ ¶i¦æ¿ï¾Ü µM«á¶}±Ò

¥»©«³Ì«á¥Ñ yangjie ©ó 2015-4-2 22:17 ½s¿è

½Ð±Ð¤j¤j
Sub openfile()
    Dim FileName As String
    Dim xlfileName As String
    Dim wb As ActiveWorkbook   
    Set wb = ActiveWorkbook
    wb.Activate
    path1 = ActiveWorkbook.Path
    ChDir path1
»Ý­n¤@­Ó ¿ï¾ÜÀɮתºµøµ¡ ¶i¦æ¿ï¾Ü    ¤£·|¼g
    Title = "Select a File to Import"
    ¿ï¾ÜFileName(2003 ©Î 2010§¡¥i¥H³Q¿ï)    If FileName = False Then
           MsgBox "No file was selected."
           Exit Sub
    End If
     xlfileName = Dir(FileName)
     Application.EnableEvents = False
          If IsOpen(xlfileName) Then
                Workbooks(xlfileName).Activate
               Set wb1 = Workbooks(xlfileName)
        Else
               Set wb1 = Workbooks.Open(FileName)
        End If
        wb1.Activate
    End If
    Application.EnableEvents = True
    On Error Resume Next
    wb1.Activate
end Sub

Function IsOpen(fs As String) As Boolean
    IsOpen = False
    For Each w In Windows
      If w.Caption = fs Then IsOpen = True: Exit For
    Next
End Function

¨D±Ï
ÁÂÁÂ

³Ìªñ¦³°Ñ¦Ò¨ìªº...
  1. With Application.FileDialog(msoFileDialogOpen)
  2.     .InitialFileName = "C:\Users\koo\Desktop\·s¼W¸ê®Æ§¨"  '''¹w³]¶}±Ò¸ô®|
  3.    .AllowMultiSelect = True
  4.    .Show
  5.    For i = 1 To .SelectedItems.Count
  6.      xk = .SelectedItems(i)
  7.    Next
  8. End With
½Æ»s¥N½X

TOP

¦^´_ 2# koo
ÁÂÁÂ
¥i§_«ü©w°ÆÀɦW¬° .*xls ©Î*.xlsx   ¤~¥i¿ï

TOP

¦^´_  koo
ÁÂÁÂ
¥i§_«ü©w°ÆÀɦW¬° .*xls ©Î*.xlsx   ¤~¥i¿ï
yangjie µoªí©ó 2015-4-2 23:29

§ä¨ì¤F ÁÂÁÂ
.Filters.Add "Excel", "*.xls; *.xlsx", 1

TOP

        ÀR«ä¦Û¦b : ¡i¬O§_µo´§¤F¨}¯à¡H¡j¤H¶¡¹Ø©R¦]¬°µu¼È¡A¤~§óÅã±o¬Ã¶Q¡CÃø±o¨Ó¤@½ë¤H¶¡¡AÀ³°Ý¬O§_¬°¤H¶¡µo´§¤F¦Û¤vªº¨}¯à¡A¦Ó¤£­n¤@¨ý¨Dªø¹Ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD