Macro/VBA script needed to prompt user to save file to specific path, using specific cell reference for name

lsomoza

New Member
Joined
Jul 21, 2020
Messages
1
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have been trying to find a macro/VBA script for this, but have not been able to.

Basically, I want the user to be able to save an excel workbook using a pre-formatted name referenced from a cell, and be prompted to selected the path.

I am using excel 2016.

I have tried a few that I have found, but none seem to work.

Thanks in advance.
 

Some videos you may like

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,594
Office Version
  1. 2007
Platform
  1. Windows
Hi and welcome to MrExcel

Check if the following is what you need
VBA Code:
Sub SaveFile()
  Dim sFile As String, sPath As String
  
  sFile = Sheets("Sheet1").Range("A2").Value
  With Application.FileDialog(msoFileDialogFolderPicker)
    .Title = "Select Folder"
    .AllowMultiSelect = False
    If .Show <> -1 Then Exit Sub
    sPath = .SelectedItems(1)
  End With

  ThisWorkbook.SaveCopyAs sPath & "\" & sFile & ".xlsm"
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,646
Messages
5,597,352
Members
414,138
Latest member
Ankitjainkaka

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
Top