以下是我的代码。基本上,它会提示用户选择文件并将其复制到目标位置。但是,我设置了AllowMultiSelect = True,但是该代码仅复制用户选择的第一个文件,而忽略其他任何文件。我想念什么?
With fDialog
' Allow user to make multiple selections in dialog box '
.AllowMultiSelect = True
' Set the title of the dialog box. '
.Title = "Please select a Video"
' Clear out the current filters, and add our own.'
.Filters.Clear
.Filters.Add "All Files", "*.*"
' Show the dialog box. If the .Show method returns True, the '
' user picked at least one file. If the .Show method returns '
' False, the user clicked Cancel. '
If .Show = True Then
' This section takes the selected image and copy's it to the generated path'
' the string takes the file location, navigates to the image folder, uses the combo box selection to decide the file category, then uses the name from the filedialog to finish the path'
FileCopy .SelectedItems(1), DLookup("Brand", "tmpDestFolders") & Dir(Trim(.SelectedItems.Item(1)))
Else
End If
End With
答案 0 :(得分:4)
浏览所有选定的项目。
For i = 1 to .SelectedItems.Count
FileCopy .SelectedItems(i), DLookup("Brand", "tmpDestFolders") & Dir(Trim(.SelectedItems(i)))
Next