Hi Guys,
im stuck with the best way to do this.
no. 1 - once I open the invoice template use vba fetch the next invoice number from the folder where the rest invoices are saved
or
no. 2- when i use my macro to save the file, with in the same macro use vba to find the next invoice number in the folder where they are saved.
my problem is i have multiple words with in my saved file its not just an invoice number as such.
any help would be a big help i cant find any vba at the moment that i can manipulate to work for me.
below is code i use with macro to save file to set location.
thanks.
im stuck with the best way to do this.
no. 1 - once I open the invoice template use vba fetch the next invoice number from the folder where the rest invoices are saved
or
no. 2- when i use my macro to save the file, with in the same macro use vba to find the next invoice number in the folder where they are saved.
my problem is i have multiple words with in my saved file its not just an invoice number as such.
any help would be a big help i cant find any vba at the moment that i can manipulate to work for me.
below is code i use with macro to save file to set location.
VBA Code:
Sub actionSaveFile()
Dim sfname As String
Dim savename As String
Dim saveLocation As String
Dim strFile As String
Dim filename As String
saveLocation = "S:\Admin\Excel Invoice's\"
savename = Sheets("Invoice").Range("C8") & (", ") & Sheets("Invoice").Range("C10") & (", ") & ("Claim") & (" ") & Sheets("Invoice").Range("F12")
strFile = "S:\Admin\Excel Invoice's\"
filename = Sheets("Invoice").Range("C8") & (", ") & Sheets("Invoice").Range("C10") & (", ") & ("Claim") & (" ") & Sheets("Invoice").Range("F12") & (".xlsm")
If FileExists(strFile + filename) = True Then
MsgBox "File name already exists, change the claim number"
Else
sfname = Application.GetSaveAsFilename(InitialFileName:=saveLocation + savename, fileFilter:="XLSM (*.xlsm), *.xslm")
ActiveWorkbook.SaveAs sfname, 52
End If
End Sub
thanks.