Forum

Saving to pdf and n...
 
Notifications
Clear all

Saving to pdf and next number

7 Posts
2 Users
0 Reactions
126 Views
(@melhabit)
Posts: 17
Eminent Member
Topic starter
 

Hello again, 

I'm looking for solutions to automate our manual invoicing/credit/proforma workbook.  I have 200+ worksheets in a workbook and it takes forever to open and close.

At the moment, I have generated a command button where I can save the worksheet as a pdf and file, but it saves as "False.pdf" every time. I thought I was picking up the invoice number by using cell A3 in the code, which is where it lives on the invoice.  I would also like to be able to pick up while saving if it is an invoice/credit etc.. the cell is A1 on the invoice and is data validated to a drop-down box.    I would appreciate help to figure it out, please.

Sub CommandButton1_Click()
'pdf format
Sheet1.Range("A1:J54").ExportAsFixedFormat x1Typepdf, Filename = "U:Groups4. AccountsManual InvoiceManual Invoice pdf 2019.20.1" & Sheet1.Range("A3").Value, openafterpublish:=True

End Sub

In the same command box, I'm looking to go to the next invoice number once the pdf is saved and generated.  I have the code for that and it works fine on a separate sheet but not within the command button.  Do I need to run this as a separate macro/separate button?

 
Posted : 28/06/2019 11:40 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Melanie,

Can you prepare a sample file with your code? It will be easier to evaluate what you have or generating the next numbers and saving to pdf.

 
Posted : 01/07/2019 11:32 pm
(@melhabit)
Posts: 17
Eminent Member
Topic starter
 

Hi Catalin

Thanks for getting back to me.  I'm not having much luck in inserting a link for you, it keeps coming up blocked.

Can I reply to the email instead?

 
Posted : 02/07/2019 5:12 am
(@catalinb)
Posts: 1937
Member Admin
 

Try simplifying your file and upload it here directly, no links needed.

 
Posted : 02/07/2019 7:43 am
(@melhabit)
Posts: 17
Eminent Member
Topic starter
 

Aha! Found the bit to upload.

 
Posted : 03/07/2019 6:08 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Melanie,

I see you have a code for setting the next number, you just need to call the NewInvoice code after you save as pdf:

Sub CommandButton1_Click()
'pdf format
Sheet1.Range("A1:J54").ExportAsFixedFormat x1Typepdf, Filename = "U:Groups4. AccountsManual InvoiceManual Invoice pdf 2019.20.1" & Sheet1.Range("A3").Value, openafterpublish:=True
Call NewInvoice
End Sub

 
Posted : 03/07/2019 9:14 am
(@melhabit)
Posts: 17
Eminent Member
Topic starter
 

Hi Catalin,

I can't believe that's all that was missing!  Thank you so much for your help, working a charm now - just need to take the plunge and go "live"

 
Posted : 04/07/2019 4:12 am
Share: