R/Sir
create a PRINT & SAVE Button on excel sheet
i am create a Tally format retail invoice in excel sheet & print the invoice in PDF format with invoice no & buyers name and save the invoice in d:/invoice folder/?
or auto change the invoice no for create a next invoice or clear the content on (A16 COLUMNS TO E24 COLUMNS) OR PRINT A TWO COPYES OF THE INVOICE (ORIGINAL FOR buyer's),(DUPLICATE FOR SELLER) BUYERS NAME IN (A9) COLUMNS , INVOICE NO. IS (C3) COLUMNS
Example for your Help:-
BUYERS NAME : EXECUTIVE ENG. IPH IS (A9) COLUMNS (CREATE A NEXT INVOICE THE BUYERS NAME WILL CHANGE )
INVOICE NO : SI-2010 ( CREATE A NEXT INVOICE THE INVOICE NO. WILL CHANGE )
INVOICE SAVED IN D:\INVOICE FOLDER\ EXECUTIVE ENG. IPH SI-2010 (CREATE A NEXT INVOICE THE INVOICE ARE SAVED IN FOR EXAMPLE D:\INVOICE FOLDER\ARUN KUMAR SI-2011)
R/SIR
I AM FIND THE VBA CODE TO THE WEB SITE
Sub Button1_Click()
Dim wbInv As Workbook
Dim wsInv As Worksheet
Dim intInv As String
Dim strInvMkr As String
Dim strTmp As String
Dim strMsg As String
Dim strSave As Boolean
Set wbInv = ThisWorkbook
On Error Resume Next
With wbInv
Set wsInv = wbInv.Sheets("Invoice")
End With
With wbInv
intInv = .Sheets("Invoice").Range("C3") 'This is your invoice number
intInv = Mid(intInv, 6, Len(intInv)) ' get the number part from invocie number
strInvMkr = "AnilKumar" 'prefix for the pdf
End With
strPath = "D:\Invoice Folder\" ' file folder
strTmp = Dir(strPath)
strCurInv = strInvMkr & intInv & ".pdf" 'new pdf file with invoice number and name
strTmp = Dir(strPath & strCurInv) ' check the same invoice number exist in the folder
If strTmp = "" Then 'if file with same invoice no does not exist
strSave = True
Else
strMsg = "Invoice Number " & intInv & " already exist!" ' if file with same invoice number
strMsg = MsgBox(strMsg, vbExclamation + vbYesNo) ' prompt for replace or quit
End If
If strMsg = vbYes Then
strSave = True
End If
If strSave = True Then
wbInv.ActiveSheet.ExportAsFixedFormat xlTypePDF, strPath & strCurInv ' save the pdf file
MsgBox "Invoice " & intInv & " PDF saved.", vbInformation
End If
For x = 1 To 3
With wsInv
If x = 1 Then
.Range("G1").Value = "Original for Buyer"
ElseIf x = 2 Then
.Range("G1").Value = "Duplicate for Seller"
Else
.Range("G1").Value = "Transporter Copy"
End If
.PrintOut ' print on your default printer
'- change this if you need to print it on other than a default printer
End With
Next
wsInv.Range("G1").Value = ""
End Sub
THIS VBA CODE IS WORKING BUT INVOICE SAVED IN D:\INVOICE FOLDER\ANIL KUMAR.PDF ( SOME PROBLEM FOUND IN THIS VBA 1. INVOICE NOT SAVED WITH BUYERS NAME & INVOICE NO.) 2. INVOICE SAVED IN PDF FORMAT WITH DEFULT VBA NAME ANIL KUMAR.PDF 3. NO PRINT OUT IN MY DEFAULT PRINTER
PLEASE HELP US :-
1) INVOICE SAVED WITH BUYERS NAME & INVOICE NO.
2) CLEAR THE CONTENTS (A16 TO E24 COLUMES)
3) INVOICE NO AUTO CHANGE
4) PRINT 2 COPYES OF THE INVOICE ((ORIGINAL FOR buyer's),(DUPLICATE FOR SELLER)
I AM ATTACH THE TALLY RETAIL INVOICE EXECL SHEET PLEASE FIND THE ATTACHMENTS
Bookmarks