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 .


    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