I have an invoice that has macros. I am trying to find a way to delete or hide them when I am saving the Invoice in a folder. They are in the form of text boxes. This is the code for the macro I am using to save the invoice.
Sub SaveInvoice()
Dim invoiceNumber As String
Dim customerName As String
Dim fileName As String
Dim filePath As String
' Get the invoice number and customer name from specific cells
invoiceNumber = Range("F5").Value
customerName = Range("A9").Value
' Construct the file name and file path
fileName = "Invoice_" & invoiceNumber & "_" & customerName & ".xlsx"
filePath = "C:\Users\Dell\Desktop\Invoices\" & fileName
' Save the active workbook with the constructed file path
Application.DisplayAlerts = False ' To suppress overwrite confirmation dialog
ThisWorkbook.SaveAs fileName:=filePath, FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True ' Restore display alerts
' Display a message box with the saved file path
MsgBox "Invoice saved at: " & filePath
End Sub
Thanks for the help!
Sub SaveInvoice()
Dim invoiceNumber As String
Dim customerName As String
Dim fileName As String
Dim filePath As String
' Get the invoice number and customer name from specific cells
invoiceNumber = Range("F5").Value
customerName = Range("A9").Value
' Construct the file name and file path
fileName = "Invoice_" & invoiceNumber & "_" & customerName & ".xlsx"
filePath = "C:\Users\Dell\Desktop\Invoices\" & fileName
' Save the active workbook with the constructed file path
Application.DisplayAlerts = False ' To suppress overwrite confirmation dialog
ThisWorkbook.SaveAs fileName:=filePath, FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True ' Restore display alerts
' Display a message box with the saved file path
MsgBox "Invoice saved at: " & filePath
End Sub
Thanks for the help!