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.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
14,780
Office Version
  1. 2010
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,764
Messages
5,833,568
Members
430,220
Latest member
SarasotaSlim

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