Auto filename but with a pop up window to manually select file path

alfgrey

New Member
Joined
Feb 22, 2014
Messages
12
Hi, I currently use the below code for some of our workbooks to auto save with a filename made up of cell values and automatically saves to a predetermined location.

Private Sub CommandButton1_Click()
Dim Path As String
Dim FileName1 As String
Dim Filename2 As String
Path = "C:\Users\desired file path etc"
FileName1 = Range("I7")
Filename2 = Range("C26")
ActiveWorkbook.SaveAs Filename:=Path & "CIS-" & FileName1 & " - " & Filename2 & ".xlsm"
Application.Dialogs(xlDialogPrint).Show
End Sub

However I now have some workbooks that i wish to still have the file name auto named (to avoid user error and maintain file name consistency / formatting) but I want the user to be able to manually select the file path.

Is this possible?

Any assistance greatly appreciated.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Untested, but try
Code:
Sub Fldr()

   Dim Fldr As Object
   Dim pth As String
   Dim FileName1 As String
   Dim Filename2 As String

   Set Fldr = Application.FileDialog(4)
   With Fldr
      .title = "Select a Folder"
      .AllowMultiSelect = False
      .Show
      pth = .SelectedItems(1)
   End With
   FileName1 = Range("I7")
   Filename2 = Range("C26")
   ActiveWorkbook.SaveAs FileName:=pth & "\CIS-" & FileName1 & " - " & Filename2 & ".xlsm"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

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