Save as New Workbook, Let User specify Folder. Name file using cell value and todays date.

Melimob

Active Member
Joined
Oct 16, 2011
Messages
396
Office Version
  1. 365
Hi there

I thought I found what I needed (almost).

I want to save the current file as
1) new workbook
2) user should specify their file path folder
3) name of file should read from Sheet11.Range("C9") (which is also a named range if easier in case it moves) =Table13[Country] + "MOVE Template" + Todays date (which I currently have in a cell)
4) AND - I need to remove the formulas from the file except on a couple of pages/ranges.

Below is my code (without the removal of formulas as I don't know how to tackle that) but I am getting an error?

Code:
Sub SaveFileAsCountry()
Dim sPath As String


' Open the file dialog
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.Show


If .SelectedItems.Count > 0 Then
sPath = .SelectedItems(1)
ThisWorkbook.SaveAs Filename:=sPath & Application.PathSeparator & Sheet11.Range("C9").Value & "_" & "MOVE_Template" & "_" & Sheet11.Range("F1").Value & ".xls", _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
Range("B1").Select
End If
End With
End Sub

Many thanks in advance!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
WARNING!! DO NOT USE BELOW CODE - HAS CORRPUPTED MY WORKBOOK WHICH I'm DESPERATELY TRYING TO SAVE...

Hi there

I thought I found what I needed (almost).

I want to save the current file as
1) new workbook
2) user should specify their file path folder
3) name of file should read from Sheet11.Range("C9") (which is also a named range if easier in case it moves) =Table13[Country] + "MOVE Template" + Todays date (which I currently have in a cell)
4) AND - I need to remove the formulas from the file except on a couple of pages/ranges.

Below is my code (without the removal of formulas as I don't know how to tackle that) but I am getting an error?

Code:
Sub SaveFileAsCountry()
Dim sPath As String


' Open the file dialog
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.Show


If .SelectedItems.Count > 0 Then
sPath = .SelectedItems(1)
ThisWorkbook.SaveAs Filename:=sPath & Application.PathSeparator & Sheet11.Range("C9").Value & "_" & "MOVE_Template" & "_" & Sheet11.Range("F1").Value & ".xls", _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
Range("B1").Select
End If
End With
End Sub

Many thanks in advance!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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