vba excel to pdf: change margin of the first page

  • Hello,

    I have a picture and some graphics in an Excel sheet (page plot), and I need to add code to create pdf report from this sheet by ignoring the print area.


    I have customized the page setup:


    then I print the desired range:

    Code
    range_to_plot.ExportAsFixedFormat Type:=xlTypePDF, FileName:=my_file_name, IncludeDocProperties:=True, IgnorePrintAreas:=True, OpenAfterPublish:=True

    the issue is that the resulting first page of the pdf file is a picture, and I need to remove all margins to fill the whole width and height of the page. But I couldn't find a way to do that, especially since it seems only the header and footer for the first page can be customized.

Participate now!

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