Search Tools Links Login

Multiple Files with CommonDialog

Posted: 2019-08-24
By: MikeG
Viewed: 192

Filed Under:

VB6 Miscellaneous, VB6 Code Cache

No attachments for this post

Ever wonder how to return multiple files using the CommonDialog control? Here is a short demonstration of how to get it done.

Private Sub cmdOpen_Click()
   Dim sFileNames() As String
   Dim iCount As Integer

   cd.Filter = "All Files|*.*"
   cd.Flags = cdlOFNAllowMultiselect

   If cd.FileName <> "" Then
      sFileNames = Split(cd.FileName, Chr(32))
      For iCount = LBound(sFileNames) To UBound(sFileNames)
         MsgBox sFileNames(iCount), vbInformation

   End If
End Sub

Special Instructions

This code originally appeared on, and has been republished here with the permission of Andrea Tincani.

Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.