Gaus Shaikh
Gaus Shaikh

Reputation: 115

save selected files in particular path

I want open file dialog box which allow me to select the multiple files. The selected files should be saved in particular path instead of opening. I am able to open the dailog box to select the files but not sure as to how to save in particular folder. Please assist.

Dim intChoice As Integer
Dim strPath As String
Dim i As Integer

Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = True
intChoice = Application.FileDialog(msoFileDialogOpen).Show
If intChoice <> 0 Then
    For i = 1 To Application.FileDialog(msoFileDialogOpen _
    ).SelectedItems.Count
        strPath = Application.FileDialog(msoFileDialogOpen _
    ).SelectedItems(i)
        Cells(i + 1, 1) = strPath
    Next i
End If

Upvotes: 0

Views: 388

Answers (1)

MatthewD
MatthewD

Reputation: 6761

Something like this. Loop through the files that are selected.

Add tools pulldown select references, pick "Microsoft Scripting runtime".

  dim fso as New FileSystemObject
  fso.CopyFile selectedFile, Targetfile

Upvotes: 1

Related Questions