ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,699
- Office Version
- 2007
- Platform
- Windows
Morning,
I have the following supplied code which works fine.
The worksheet that this code is on is named INVOICE.
I have copied this worksheet & named it INVOICE 2
What i would like to do is after the current invoice number has incremented by 1 on INVOICE 1 have the same happen for INVOICE 2
If you can advise i will the also add this code to INVOICE 2 to do the same for INVOICE
Range("N4").Value = Range("N4").Value + 1 worksheet ="INVOICE2" ETC ETC
I have the following supplied code which works fine.
The worksheet that this code is on is named INVOICE.
I have copied this worksheet & named it INVOICE 2
What i would like to do is after the current invoice number has incremented by 1 on INVOICE 1 have the same happen for INVOICE 2
If you can advise i will the also add this code to INVOICE 2 to do the same for INVOICE
Range("N4").Value = Range("N4").Value + 1 worksheet ="INVOICE2" ETC ETC
Code:
Private Sub Clear_Invoice_After_Printing_Click()
Dim objWord As New Word.Application
'Copy the range Which you want to paste in a New Word Document as a screenshot
Dim strFileName As String
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DR COPY INVOICES\Invoice " & Range("N4").Value & " " & Format(Now, "dd-mm-yyyy") & ".doc"
Range("G3:O60").CopyPicture xlPrinter
With objWord
With .Documents.Add
.Parent.Selection.Paste
.SaveAs strFileName
.Close
End With
'.Visible = True
.Quit
End With
MsgBox strFileName, vbInformation, "Invoice Saved as Screenshot Word.doc"
Range("G13:I18").ClearContents
Range("N14:O18").ClearContents
Range("G27:N42").ClearContents
Range("G13:I13").ClearContents
Range("G49:I49").ClearContents
Range("G48:I48").ClearContents
Range("G47:I47").ClearContents
Range("G46:I46").ClearContents
Range("G45:I45").ClearContents
Range("N4").Value = Range("N4").Value + 1
Range("G13").Select
ActiveWorkbook.Save
End Sub