我想打开文件对话框,允许我选择多个文件。所选文件应保存在特定路径中而不是打开。我可以打开dailog框来选择文件,但不知道如何保存特定文件夹。请协助。
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
答案 0 :(得分:1)
像这样的东西。遍历所选的文件。
添加工具下拉选择引用,选择“Microsoft Scripting runtime”。
dim fso as New FileSystemObject
fso.CopyFile selectedFile, Targetfile