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

[µo°Ý] ¿ï¾Ü¸ê®Æ§¨ ¶i¦Ó¨ú±o¨ä¦W¦r

[µo°Ý] ¿ï¾Ü¸ê®Æ§¨ ¶i¦Ó¨ú±o¨ä¦W¦r

½Ð±Ð¦U¦ì¥ý¶i­Ì
        ¦bªí³æ¸Ì  ·Q¥Îµøµ¡§@¿ï¾Ü  ±o¨ì ¬Y¤@­Ó¸ê®Æ§X¦W¦r(§t¸ô®|) À³¦p¤U»yªk?
Ãþ¦ü¦p¤Uµøµ¡§@¿ï¾Ü  ±o¨ì ¬Y¤@­ÓÀÉ
    Filt = "Excel Files (*.xls),*.xls"
    FilterIndex = 5
    Title = "¿ï¾Ü¸ê®Æ¶×¤J¤§¨Ó·½ExcelÀÉ"
    FileName = Application.GetOpenFilename _
        (FileFilter:=Filt, _
         FilterIndex:=FilterIndex, _
         Title:=Title)
    If UCase(FileName) = "FALSE" Then
        MsgBox "No file was selected."
        Exit Sub
    End If
    xlfileName = Dir(FileName)
¦Ó§Ú»Ý­nªº¬O  ¿ï¾Ü¸ê®Æ§¨     ¶i¦Ó¨ú±o¨ä¸ê®Æ§¨¦W¦r¡C
¨D±Ï©ó¥ý¶i­Ì            ÁÂÁÂ

¦^´_ 3# GBKEE
Á¤F

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-2 10:29 ½s¿è

¦^´_ 2# yangjie
  1. Set fd = Application.FileDialog(msoFileDialogFolderPicker)
  2.     With fd
  3.      .AllowMultiSelect = True '
  4.      'AllowMultiSelect ÄÝ©Ê True ¦pªG¤¹³\¨Ï¥ÎªÌ±qÀÉ®×¹ï¸Ü¤è¶ô¿ï¨ú¦h­ÓÀɮסCŪ/¼g Boolean
  5.     '¦ýAllowMultiSelect Äݩʹï msoFileDialogFolderPicker ¤£°_§@¥Î
½Æ»s¥N½X
¥i¥Îªí³æ
  1. Option Explicit
  2. Private Sub UserForm_Initialize()
  3.     Ex
  4.     With ListBox1  '½Ð¥ý¦bªí³æ¤¤¥[¤J³o±±¨î¶µ
  5.         .Font.Size = 12
  6.         .Top = 10
  7.         .Height = .ListCount * .Font.Size
  8.          DoEvents
  9.         .Left = 10
  10.         .Width = 300
  11.         .MultiSelect = fmMultiSelectMulti  '±µ¨ü¦h­«¿ï¨ú
  12.         Width = .Width + 20
  13.         Height = .Height + 40
  14.     End With
  15. End Sub
  16. Private Sub ListBox1_Change()
  17.     Dim s As String, i As Integer
  18.     With ListBox1
  19.         For i = 0 To .ListCount - 1
  20.             If .Selected(i) = True Then s = s & .List(i) & vbLf
  21.         Next
  22.         If s <> "" Then MsgBox s
  23.     End With
  24. End Sub
  25. Private Sub Ex()
  26.     Dim f As Object, e
  27.     Set f = CreateObject("Scripting.FileSystemObject").getfolder(CurDir).SubFolders
  28.     For Each e In f
  29.         ListBox1.AddItem e
  30.     Next
  31. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 1# yangjie
¦Û¦æ°Ñ¦Ò»¡©ú ¦Û½s¦¨¦p¤U:
Sub getfolder()
    Dim f1 As Object
    Set f1 = CreateObject("Scripting.FileSystemObject")
    Dim fd As FileDialog
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    Dim vrtSelectedItem As Variant
    With fd
        .Filters.Add "Images", "*.gif; *.jpg; *.jpeg", 1
        .FilterIndex = 2
        If .Show = -1 Then
            For Each FileName In .SelectedItems
                 FolderName = f1.GetParentFolderName(Path:=FileName)
            Next FileName
        End If
    End With
    Set f1 = Nothing
    Set fd = Nothing
End Sub
¦ý¤£·|³]©w¦¨¥u¯à¿ï¤@­Ó?  ½Ð±Ð±Ð§Ú¡I

TOP

        ÀR«ä¦Û¦b : ª¾ÃÑ­n¥Î¤ßÅé·|¡A¤~¯àÅܦ¨¦Û¤vªº´¼¼z¡C
ªð¦^¦Cªí ¤W¤@¥DÃD