vba excel to pdf

  • hi dears

    i have excel file and after convert to pdf , there are many empty margin in page. but if i convert excel to jpg and with acrobat reader convert jpg to pdf , then there is no margin and empty margin .

    i adjust page zoom,printarea,scale to fit , software printer , print to file , save as pdf and etc .

    are have any macro to do it for entire workbook , without any empty margin ? if these macro have these option is very good

    1- printarea by default selected for each sheets , for to convert in pdf

    2-export pdf use minimum size pdf format .

    3-TOTAL MARGIN SET 0.25 INCH


    Code
    Option Explicit
    Sub Print_PDF()
    Dim Awb As Workbook
    Dim Snr As Integer
    Dim ws As Worksheet
    Set Awb = ActiveWorkbook  For Each ws In Awb.Sheets    If Not ws.Name = "Sheet1" Then        'Sheets(ws.Name).Copy        Awb.Sheets(ws.Name).Copy        'Sheets(ws.Name).Select        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _        Awb.Path & "\" & Awb.Sheets(ws.Name).Name & ".pdf", _        Quality:=xlQualityStandard, IncludeDocProperties:=True, _        IgnorePrintAreas:=False, OpenAfterPublish:=False               ActiveWindow.Close False    End If
    Next ws
    end sub



    for example i attached xlsm file to try on it in google drive

  • This doesn't even necessitate the use of VBA!


    To customize the fast access toolbar, right-click on the Ribbon and select Customize Quick Access Toolbar. Select all commands from the middle dropdown. Look for something along the lines of "Export Sheet to PDF." It should be added to the toolbar. Once you click it, the sheet will be exported to PDF and given the same name as the workbook.


    The command for emailing a spreadsheet is the same. These two items have completely changed the game.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!