Next Invoice Number Save as .xlsm

erware

New Member
Joined
Nov 20, 2019
Messages
9
I have a Macro enable template with the below Macro that you wrote. It works but I would like for it to save the new file as a macro enable file "xlsm" instead of an excel .xlsx file. Is this possible?

Sub SaveAndNewInvoiceWithNewName()
Dim NewFN As Variant
' Copy Invoice to a New Workbook
ActiveSheet.Copy
NewFN = "C:\Users\Eddie\Documents\IDrive-Sync\Dropbox\LB Historical Society\Treasurer's Programs\Invoicing\Invoices\" & Range("F10") & Range("G10") & Range("H10") & Range("C22") & Range(" D17 ").Value
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
NextInvoice
Range("G10").Value = Range("G10").Value + 1
Range("C25:D42").ClearContents

End Sub
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Change this argument in your code:
Code:
FileFormat:=xlOpenXMLWorkbook
to this:
Code:
FileFormat:=xlOpenXMLWorkbookMacroEnabled
 
Upvote 0
My invoice template has 4 drop down tables but they are not saved when running the macro. Is there a way to include the drop down tables in the saved file?
 
Upvote 0
What exactly are these drop-down tables?
How are they created?
Are they linked to anything?
 
Upvote 0
They were created with the Data Validation function. I have 3 of these, Select Customer, Select Invoice Status and Item Code. See attached screen shot.
 

Attachments

  • Drop down.JPG
    Drop down.JPG
    29.4 KB · Views: 8
Upvote 0
I believe I know why they are not included with the save file, the Data Validation criteria is located on 3 other sheets, Products, Clients, and Terms, and they are not included with the new file.
 
Upvote 0
Yes, you are only copying over the one sheet.
If you want them, you may need to copy over the whole file instead (or at least the other sheets also).
 
Upvote 0
I am not into much coding, I can record macro and find help like yours on YouTube. How can I modify the above code to include at least the "Terms" sheet?
I am glad I found your site, you have a wealth of useful information.
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

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