+ Reply to Thread
Results 1 to 1 of 1

print & save in pdf

  1. #1
    Forum Contributor
    Join Date
    07-21-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    170

    print & save in pdf

    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
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Print & save
    By anil21 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2013, 03:59 AM
  2. where can i find macro codes for various functions such print, save and save as
    By fellayaboy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2011, 02:06 AM
  3. Print only visible rows and a print to or save as pdf Macro
    By rlebeausw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2011, 10:08 PM
  4. Print and Save
    By lyilaly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2007, 05:59 PM
  5. excell won't print wants to save not print
    By medic13 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 04-12-2006, 12:55 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1