Open

Allows the user to open a file


Dim objFileDialog As Office.FileDialog 
    Set objFileDialog = Application.FileDialog(MsoFileDialogType.msoFileDialogOpen)
    
    With objFileDialog
        .InitialFileName = "C:\Temp\MyFolder\"
        .InitialView = msoFileDialogView.msoFileDialogViewLargeIcons
        .AllowMultiSelect = True

        If (.Show > 0) Then
        End If

        ltotalfiles = .SelectedItems.Count

        For lfilecount = 1 To ltotalfiles
           sFullPath = .SelectedItems(lfilecount)
           sFolderPath = modGeneral.Folder_FolderRemoveFile(sFullPath, "/")

           If (lfilecount = 1) Then
              Me.txtFolderPath = sFolderPath
           End If

           sFileName = Right(sFullPath, Len(sFullPath) - Len(sFolderPath))
           Call MsgBox(sFileName)
        Next lfilecount
    End With

FileDialogSelectedItems - A collection of string values that correspond to the folder paths of the files or folders that have been selected.



© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited TopPrevNext