Click here to Skip to main content
15,894,955 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I used the same method for my invoices and now that I want to apply it to the billing statement it gives me Compile error: Sub or Function not defined. Even I run it it highlights the NEXTBILL. I am not sure how to fix it. I am trying to Save my worksheet as a separate file but before it does that I want it to register on my registry.I want it to save it as the title BillingStatement with the statement #. Please advice

Sub SaveStatementWithNewName()
Dim NewFN As Variant
PostToRegister
ActiveSheet.Copy
NewFN = "C:\Users\iaquino\Documents\Billing Statements\" & Range("K4").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
NextBill
Posted
Comments
Richard Deeming 14-Dec-15 14:06pm    
Sounds like the method NextBill isn't defined; or it's defined in the active workbook, which you've just closed.
Member 12196950 14-Dec-15 14:56pm    
Yes, so what im trying to do is save a copy of all previous invoices. Then create file name with billing statement and billing #. So I changed the NExtBill to NextBillingStatement.
ZurdoDev 14-Dec-15 15:13pm    
1. Reply to the comment so that the user is notified.
2. Did you resolve your problem? If so, please post a solution so this no longer shows unanswered. If you did not resolve your problem then what is the question?
Member 12196950 15-Dec-15 11:00am    
How do I correct the error. What I am trying to do is, save each bill on a separate workbook after I enter it and before I clear it. I was able to do this with the invoices but I can not figure out how to fix the error. I also want the bill to post the information on the register tab before saving it as its own workbook, I am very new to this VBA program.
RedDk 16-Dec-15 14:13pm    
'Been a long time since I looked at VBA code but one thing strikes me here and that is the string NewFN is using a non-8dot3 path directory. So, you might try reconstructing that using whatever DIR /X (commandline output) tells you it's "short name" happens to be. Something like: "Billin~2", etc.

Just a thought.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900