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
    1. Option Explicit
    2. Sub Print_PDF()
    3. Dim Awb As Workbook
    4. Dim Snr As Integer
    5. Dim ws As Worksheet
    6. 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
    7. Next ws
    8. 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.

  • royUK

    Closed the thread.