如题

解决方案 »

  1.   

    顺带问一下:打开文件对话框的API怎么才能取得多个文件名?
      

  2.   

    是用FileListBox控件?这个控件有个属性:MultiSelect,设定能多选就行了.
      

  3.   

    何不用Files集合,遍历一下挨个取得其必要属性,然后就随心所欲了……
      

  4.   

    '添加 Drive1 Dir1 File1 Command1 List1Option Explicit
    'File1.MultiSelect =2  ' 你在属性窗里面设Dim i%, dirpath$
    Private Sub Dir1_Change()
       File1.Path = Dir1.Path
    End SubPrivate Sub Drive1_Change()
       Dir1.Path = Drive1.Drive
    End SubPrivate Sub Command1_Click()
       dirpath = IIf(Right(Dir1.Path, 1) = "\", Dir1.Path, Dir1.Path & "\")
       If File1.ListCount > 0 Then
          List1.Clear
          For i = 0 To File1.ListCount - 1
             If File1.Selected(i) Then List1.AddItem dirpath & File1.List(i)
          Next i
       End If
    End Sub
      

  5.   

    '添加 Drive1 Dir1 File1 Command1
    'File1.MultiSelect   =2     '你在属性窗里面设Option Explicit
    Dim i%, dirpath$, Selstr$(), trec%
    Private Sub Dir1_Change()
       File1.Path = Dir1.Path
    End SubPrivate Sub Drive1_Change()
       Dir1.Path = Drive1.Drive
    End SubPrivate Sub Command1_Click()
       dirpath = IIf(Right(Dir1.Path, 1) = "\", Dir1.Path, Dir1.Path & "\")
       If File1.ListCount > 0 Then
          ReDim Preserve Selstr$(0)
          trec = 0: Selstr(0) = ""
          For i = 0 To File1.ListCount - 1
             If File1.Selected(i) Then
                ReDim Preserve Selstr$(trec)
                Selstr(trec) = dirpath & File1.List(i)
                trec = trec + 1
             End If
          Next i
          '************ 看看上面的数组变量
          If Selstr(0) <> "" Then '检测数组中是否有选中内容
             Me.Cls
             For i = 0 To trec - 1
                Print Selstr(i)
             Next i
             MsgBox "共选中 " & CStr(trec) & " 笔"
          Else
             MsgBox "无选中内容"
          End If
       End If
    End Sub