Please, I have a file that creates a folder called "Electronic Library" in the same file path
Windows Explorer opens to display all files and all formats
Required
Copy any file to this folder with its original name and copy the name to the textbox
Thank you for your help
Private Sub CommandButton1_Click()
Dim strFolder As String
Dim GetFilePath As String
Dim FileSourcePath As String
Dim FileDestinationPath As String
strFolder = ThisWorkbook.Path & Application.PathSeparator & "Electronic Library"
If Dir(strFolder, vbDirectory) = "" Then
MkDir strFolder
End If
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Filters.Add "Electronic Library", "*.????"
If .Show <> 0 Then
GetFilePath = .SelectedItems(1)
End If
End With
Me.TextBox1.Value = GetFilePath
FileSourcePath = Trim(GetFilePath)
FileDestinationPath = ThisWorkbook.Path & "\Electronic Library\" & "." & Split(FileSourcePath, ".")(UBound(Split(FileSourcePath, ".")))
FileCopy FileSourcePath, FileDestinationPath
End Sub
Windows Explorer opens to display all files and all formats
Required
Copy any file to this folder with its original name and copy the name to the textbox
Thank you for your help
Private Sub CommandButton1_Click()
Dim strFolder As String
Dim GetFilePath As String
Dim FileSourcePath As String
Dim FileDestinationPath As String
strFolder = ThisWorkbook.Path & Application.PathSeparator & "Electronic Library"
If Dir(strFolder, vbDirectory) = "" Then
MkDir strFolder
End If
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Filters.Add "Electronic Library", "*.????"
If .Show <> 0 Then
GetFilePath = .SelectedItems(1)
End If
End With
Me.TextBox1.Value = GetFilePath
FileSourcePath = Trim(GetFilePath)
FileDestinationPath = ThisWorkbook.Path & "\Electronic Library\" & "." & Split(FileSourcePath, ".")(UBound(Split(FileSourcePath, ".")))
FileCopy FileSourcePath, FileDestinationPath
End Sub