Saving selected and renamed supplimentary file from with current workbook

Paul Sansom

Board Regular
Joined
Jan 28, 2013
Messages
178
Office Version
  1. 2021
  2. 2016
Platform
  1. 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


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
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Replace
Code:
Application.FileDialog(msoFileDialogSaveAs).Title = filesave
with
Code:
            Name file As filesave
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top