Paul Sansom
Board Regular
- Joined
- Jan 28, 2013
- Messages
- 178
- Office Version
- 2021
- 2016
- Platform
- Windows
Hi
I want to give my users the chance to pick supplementary files that are relevant to current workbook and then rename and save then in s specific folder.
All code below works excep the save function and i am not sure its the right function.
I am not saving the current workbook and want to maintain the file type of the original supplementary file!!
filesavename is the renamed file (eg SUPFILE 201708070001.png)
filesave is path to ShaerPoint library + filesavename (eg https://..........SUPFILE 201708070001.png)
All above is fine, but i cant get the savecode
Any help much appreciated..... Paul
I want to give my users the chance to pick supplementary files that are relevant to current workbook and then rename and save then in s specific folder.
All code below works excep the save function and i am not sure its the right function.
I am not saving the current workbook and want to maintain the file type of the original supplementary file!!
filesavename is the renamed file (eg SUPFILE 201708070001.png)
filesave is path to ShaerPoint library + filesavename (eg https://..........SUPFILE 201708070001.png)
All above is fine, but i cant get the savecode
Any help much appreciated..... Paul
Code:
Sub Test()
Dim fDialog As FileDialog, result As Integer
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
'IMPORTANT!
fDialog.AllowMultiSelect = True
'Optional FileDialog properties
fDialog.Title = "Select a file"
fDialog.InitialFileName = "C:\Users\Paul\Pictures\Captures"
'Optional: Add filters
fDialog.Filters.Clear
'Show the dialog. -1 means success!
If fDialog.Show = -1 Then
For Each file In fDialog.SelectedItems
fn = fn + 1
fn = Format(fn, "0000")
extFind = Right$(file, Len(file) - InStrRev(file, "."))
filesavename = Sheet9.Range("N64") & fn & "." & extFind
filesave = Sheet9.Range("N63") & filesavename
Application.FileDialog(msoFileDialogSaveAs).Title = filesave ' this line does not work
Next file