Hello,
I would appreciate some advice with an issue i have from you experts out there. I have a macro to create the next invoice number and saves the file with the invoice number and creates the next invoice. What I would like to do is save the first page as a PDF File. I have this working but it produces all 5 pages - what do i have to do to print only the 1st page?
Sub SaveInvWithNewName()
Dim NewFN As Variant
PostToRegister
'MAKEPDF Macro'
ActiveSheet.ExportAsFixedFormat Type:=x1TypePDF, Filename:="Y:\Dropbox\Accounts\Accounts\Sales\DELIVERY NOTES\SI" & Range("J22")
'Copy Invoice to a new workbook
ActiveSheet.Copy
NewFN = "Y:\Dropbox\Accounts\Accounts\Sales\DELIVERY NOTES\DN" & Range("J22").Value & ".xlsx"
Application.DisplayAlerts = False 'Inhibit display/ default yes to application dialogs
With ActiveWorkbook 'New Invoice workbook
'Save as
.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
'Delete the Macro button shapes
.ActiveSheet.Shapes("5-Point Star 1").Cut
.ActiveSheet.Shapes("Rounded Rectangle 2").Cut
'Close and save
.Close SaveChanges:=True
End With
Application.DisplayAlerts = True 'Reset alerts
NextInvoice
End Sub
thanks for you help in advance
I would appreciate some advice with an issue i have from you experts out there. I have a macro to create the next invoice number and saves the file with the invoice number and creates the next invoice. What I would like to do is save the first page as a PDF File. I have this working but it produces all 5 pages - what do i have to do to print only the 1st page?
Sub SaveInvWithNewName()
Dim NewFN As Variant
PostToRegister
'MAKEPDF Macro'
ActiveSheet.ExportAsFixedFormat Type:=x1TypePDF, Filename:="Y:\Dropbox\Accounts\Accounts\Sales\DELIVERY NOTES\SI" & Range("J22")
'Copy Invoice to a new workbook
ActiveSheet.Copy
NewFN = "Y:\Dropbox\Accounts\Accounts\Sales\DELIVERY NOTES\DN" & Range("J22").Value & ".xlsx"
Application.DisplayAlerts = False 'Inhibit display/ default yes to application dialogs
With ActiveWorkbook 'New Invoice workbook
'Save as
.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
'Delete the Macro button shapes
.ActiveSheet.Shapes("5-Point Star 1").Cut
.ActiveSheet.Shapes("Rounded Rectangle 2").Cut
'Close and save
.Close SaveChanges:=True
End With
Application.DisplayAlerts = True 'Reset alerts
NextInvoice
End Sub
thanks for you help in advance