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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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
 
Upvote 0

Forum statistics

Threads
1,214,628
Messages
6,120,618
Members
448,973
Latest member
ChristineC

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