I want to copy a selected file to a folder and I think a good time for it is when I'm closing the File Dialog. How do I do this?
File Dialog entry and exit:
Destiny folder:
thx for help
File Dialog entry and exit:
Code:
Private Sub File_Dialog_Click()
Dim fd As FileDialog
Dim varFile As Variant
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
.Title = "Please select one or more files"
.Filters.Clear
.Filters.Add "All Files", "*.*"
If .Show = True Then
For Each varFile In .SelectedItems
Me.File.Value = .SelectedItems.Item(1)
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub
Private Sub File_Dialog_Exit(Cancel As Integer)
Me.File_Name = Mid([File], InStrRev([File], "\") + 1, InStrRev([File], ".") - InStrRev([File], "\") - 1)
Me.File_Type = Right([File], Len([File]) - InStrRev([File], "."))
End Sub
Destiny folder:
Code:
Public Sub Create_Folder(sFolder As String)
If Len(Dir(sFolder, vbDirectory)) = 0 Then
MkDir sFolder
End If
End Sub
Public Sub FolderCheck()
Create_Folder ("E:\" & Format(Date, "yyyy"))
Create_Folder ("E:\" & Format(Date, "yyyy") & "\" & Format(Date, "mm") & " " & Format(Date, "mmmm"))
End Sub
thx for help
Last edited: