A
akphidelt
Howdy fellas. I'm working on a code in access. What I'm trying to do is allow
people to Save a file from their documents and automatically save that file
in to the common drive folder.
Right now, here is my code. This code allows me to get the path of the
selected file, but now I want to be able to save that path to a different
path.
The steps I want are
1) open file dialog
2) double click on the file you want
3) macro automatically saves that file in to a different path
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim filePath As String
Dim fileName As String
filePath = "C:\Test"
fileName = Me.txtFileName
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.Title = "Select File"
.Filters.Clear
.Filters.Add "All Files", "*.*"
If .Show = True Then
For Each varFile In .SelectedItems
Me.txtPath.Value = varFile
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
'Right here I want it to save varFile as filePath & fileName
Any help will be greatly appreciated. Thanks!
people to Save a file from their documents and automatically save that file
in to the common drive folder.
Right now, here is my code. This code allows me to get the path of the
selected file, but now I want to be able to save that path to a different
path.
The steps I want are
1) open file dialog
2) double click on the file you want
3) macro automatically saves that file in to a different path
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim filePath As String
Dim fileName As String
filePath = "C:\Test"
fileName = Me.txtFileName
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.Title = "Select File"
.Filters.Clear
.Filters.Add "All Files", "*.*"
If .Show = True Then
For Each varFile In .SelectedItems
Me.txtPath.Value = varFile
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
'Right here I want it to save varFile as filePath & fileName
Any help will be greatly appreciated. Thanks!