Forum

Save Workbook Copy ...
 
Notifications
Clear all

Save Workbook Copy based on multiple criteria in cells

3 Posts
2 Users
0 Reactions
79 Views
(@webbers)
Posts: 147
Estimable Member
Topic starter
 

I am trying to simply make a copy of an entire workbook for audit purposes.  The name that will be created for the workbook is based on 2 cells on the "Main" sheet.  I am not sure why this is happening as I am certain this is a simple macro.  In addition I would like BOTH the Template (current workbook) and the NEW workbook to save and close, without asking for any prompts.  Thanks so very much!!!!

D1 - The Name of the new Workbook

B14 - Today's date

 

Sub SaveAudit()

' Save file as multiple cell references

Dim FName As String
Dim FPath As String

' New file name WITHOUT extension
FName = Range("$D$1").Value & Format(Range("$B$14").Value, "mm-dd-yyyy") & ".xlsb"
FPath = ThisWorkbook.Path & "" & FName

ThisWorkbook.SaveCopyAs Filename:=FPath & "" & FName

End Sub

 
Posted : 20/05/2022 2:35 pm
(@catalinb)
Posts: 1937
Member Admin
 

Hi Sherry,

I am not sure why this is happening as I am certain this is a simple macro.

What is happening?

After SaveCopyAs just use:

ThisWorkbook.Close True

The copy is closed already, SaveCopyAs should create a copy without opening the newly created file.

 
Posted : 24/05/2022 12:34 am
(@webbers)
Posts: 147
Estimable Member
Topic starter
 

@Catalin Bombea

Perfect!  I feel so silly, as this answer IS simple just as I had thought!  Thanks so very much!!!!

 
Posted : 26/05/2022 9:34 am
Share: