Excelguruintraining
New Member
- Joined
- Apr 23, 2015
- Messages
- 24
Im trying to save my workbook with a vba code. My code is below the line thats giving me problems is
Im getting an Mismatch error. Any help would be appreciated!
Im getting an Mismatch error. Any help would be appreciated!
Code:
Sub Saveinvwithnewname()
Dim NewFN As Variant
' Copy invoice to a new workbook
ActiveWorkbook.Sheets(Array("Quote Prep", "Quotation", "Purchase Order", "Purchase Order (2)", "Purchase Order (3)", "Purchase Order (4)", "Purchase Order (5)")).Select
If Worksheets("Quotation").Range("Salesman") = ("Anthony Meyer") Then
Set NewFN = "\\COSPEC\Documents\Sales Documents\Anthony\Anthonys Quotes\Quote" & Range("Quote").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ElseIf Worksheets("Quotation").Range("Salesman") = ("Mike Garcia") Then
Set NewFN = "\\COSPEC\Documents\Sales Documents\Mike\Mikes Quotes\Quote" & Range("Quote").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ElseIf Worksheets("Quotation").Range("Salesman") = ("Heather Mason") Then
Set NewFN = "\\COSPEC\Documents\Sales Documents\Heather\Heathers Quotes\Quote" & Range("Quote").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
End If
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
NextInvoice
Worksheets("Quote prep").Select
End Sub