/ Forums / Advansys Formativ / Creating Solutions with Formativ / Select multiple files with OpenFileDialog

  • Creator
  • #4207


    I use the following code for selecting an attachment to a message. How can I select more than one file with the open file dialog?

    Sub Main(Client, GWEvent)

    dim ObjFSO
    dim bijlage

    set ObjFSO = Utilities.NewOpenFileDialog
    ObjFSO.Filter = “Word Documenten|*.doc|Excel sheets|*.xls|PDF bestanden|*.pdf|All Files|*.*”
    ObjFSO.InitialDir = “c:”
    ObjFSO.Title = “Select your attachment”
    InitFSO = ObjFSO.Execute
    If InitFSO = False Then
    bijlage = “”
    bijlage = ObjFSO.FileName
    End If

    msgbox “You selected the file: ” & bijlage

    End Sub

    Kind regards,
    Roland Leurs

  • Author
  • #7486
    Support 1

    Dear Roland,

    Thank you for enquiry.

    Unfortunately OpenFileDlg (the object returned by Utilities.NewOpenFileDialog), does not support multiple selection of files.

    If you are using Formativ 2.0, the Forms Editor includes TOpenDialog on the Dialogs tab of the Component Palette. TOpenDialog has a similar interface to OpenFileDlg but is more powerful, with additional properties. The following is quoted from the help file on TOpenDialog’s Files property:


    Files is a string list that contains each selected file name with its full directory path. (To let users select multiple file names, set the ofAllowMultiSelect flag in Options.) Use properties and methods for string lists to traverse this list of files and read individual items.

    I hope this helps.

    Advansys Support

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.