Good day,
I'm not the fondest when it comes to knowledge with Excel, so slightly asking a newbie question and looking for a possible resolution.
The current output I have is as follows:
Public Sub SetNewInvoiceNo()
'*************************************************************************
'A new invoice number will be generated everytime the document is opened.
'*************************************************************************
strInvNo = Trim(Right(Str$(DatePart("yyyy", Date)), 2)) & _
Trim(Str$(DatePart("y", Date))) & _
Trim(Str$(DatePart("h", Time))) & _
Trim(Str$(DatePart("n", Time))) & _
Trim(Str$(DatePart("s", Time)))
strInvNo = strInvNo
strNewInvoice = Str(Val(strInvNo))
ActiveSheet.Protect
ActiveWorkbook.Worksheets(1).Cells(6, 16).Value = strInvNo <-------string that's causing the error
ActiveSheet.Protect DrawingObjects:=True, contents:=True, Scenarios:=True
ActiveSheet.Protect DrawingObjects:=True, contents:=True, Scenarios:=True
MsgBox "A new invoice# is generated each time this document is opened. " & _
"This feature lets you use your original invoice as a model for creating a new invoice. " & _
vbCrLf & " Previous Invoice Number: " & strOldInvoice & _
vbCrLf & " New Invoice Number: " & strNewInvoice, vbOKOnly, "New Invoice Number Generated"
End Sub
I've gotten this to work before without receiving this error, unsure of what I changed to get it to work to be honest. I've researched this throughout many points of google but stumped as to what is stopping this from working correctly.
Any insight would be greatly appreciated and to help a newbie understand this.
Thanks!!
Shawn
*Edit* When I close and reload the document, I receive a new error of 1004 - Out of Stack Space. This has got me confused even more now >,<
Bookmarks