Delete header Sample Excel file saved as PDF












0















I am working on a Excel report that takes data from another Excel Workbook, imports the data and does statistical analysis. This is moved to a worksheet and graphs are generated from the data. All of this is formatted for printing. In the Macros that are written to do this is a sub macro that takes this Report and saves it to a network drive for uploading and also shows the PDF so you can print it.
The problem: when it creates the PDF it adds a line to the top of the PDF that states "Sample Excel file Saved as PDF". This is also on the saved PDF that will be uploaded as part of file in our HIS.
How do I not get this on the PDF. It is not part of, and should not be on the PDF.



Below is the code I use to setup the PDF save and Print it.



Sub Save_PDF()

Dim Path1 As String
Dim Path2 As String
Path1 = "c:Test Result..."

'Range where spefic file name is placed for this occurance

Path2 = Range("A79")

With ActiveSheet.PageSetup
.Orientation = xlPortrait
.PrintArea = "$A$1:$AE$75"
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
End With

'Setup saves as report and place in drive for upload to HIS

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
filename:=Path1 & Path2, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False









share|improve this question




















  • 1





    This may not be an Excel issue, but the PDF print driver. Try printing a Word document to a PDF and see if you get something similar. You may have a Freeware software driver and they often append some type of header/footer to printouts until you make the purchase.

    – Rey Juna
    Nov 21 '18 at 17:39











  • Thanks I'll check that out. This is a corporate computer and office suite, with no special addon that I am aware of. The Network has a driver for CutePDF that I sometimes use from Word, or Excel and have never had this issue. I'm using the xlTypePDF from in the VBA. I'm not sure how to call the CutePDF driver from VBA or if I can. I have gone through the Print settings that I know about and there are no headers/footers or odd margins that I can find.

    – Terry B
    Nov 21 '18 at 19:55











  • Recommend recording a macro of your manual Excel print job. See answer below.

    – Rey Juna
    Nov 21 '18 at 20:23
















0















I am working on a Excel report that takes data from another Excel Workbook, imports the data and does statistical analysis. This is moved to a worksheet and graphs are generated from the data. All of this is formatted for printing. In the Macros that are written to do this is a sub macro that takes this Report and saves it to a network drive for uploading and also shows the PDF so you can print it.
The problem: when it creates the PDF it adds a line to the top of the PDF that states "Sample Excel file Saved as PDF". This is also on the saved PDF that will be uploaded as part of file in our HIS.
How do I not get this on the PDF. It is not part of, and should not be on the PDF.



Below is the code I use to setup the PDF save and Print it.



Sub Save_PDF()

Dim Path1 As String
Dim Path2 As String
Path1 = "c:Test Result..."

'Range where spefic file name is placed for this occurance

Path2 = Range("A79")

With ActiveSheet.PageSetup
.Orientation = xlPortrait
.PrintArea = "$A$1:$AE$75"
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
End With

'Setup saves as report and place in drive for upload to HIS

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
filename:=Path1 & Path2, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False









share|improve this question




















  • 1





    This may not be an Excel issue, but the PDF print driver. Try printing a Word document to a PDF and see if you get something similar. You may have a Freeware software driver and they often append some type of header/footer to printouts until you make the purchase.

    – Rey Juna
    Nov 21 '18 at 17:39











  • Thanks I'll check that out. This is a corporate computer and office suite, with no special addon that I am aware of. The Network has a driver for CutePDF that I sometimes use from Word, or Excel and have never had this issue. I'm using the xlTypePDF from in the VBA. I'm not sure how to call the CutePDF driver from VBA or if I can. I have gone through the Print settings that I know about and there are no headers/footers or odd margins that I can find.

    – Terry B
    Nov 21 '18 at 19:55











  • Recommend recording a macro of your manual Excel print job. See answer below.

    – Rey Juna
    Nov 21 '18 at 20:23














0












0








0








I am working on a Excel report that takes data from another Excel Workbook, imports the data and does statistical analysis. This is moved to a worksheet and graphs are generated from the data. All of this is formatted for printing. In the Macros that are written to do this is a sub macro that takes this Report and saves it to a network drive for uploading and also shows the PDF so you can print it.
The problem: when it creates the PDF it adds a line to the top of the PDF that states "Sample Excel file Saved as PDF". This is also on the saved PDF that will be uploaded as part of file in our HIS.
How do I not get this on the PDF. It is not part of, and should not be on the PDF.



Below is the code I use to setup the PDF save and Print it.



Sub Save_PDF()

Dim Path1 As String
Dim Path2 As String
Path1 = "c:Test Result..."

'Range where spefic file name is placed for this occurance

Path2 = Range("A79")

With ActiveSheet.PageSetup
.Orientation = xlPortrait
.PrintArea = "$A$1:$AE$75"
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
End With

'Setup saves as report and place in drive for upload to HIS

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
filename:=Path1 & Path2, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False









share|improve this question
















I am working on a Excel report that takes data from another Excel Workbook, imports the data and does statistical analysis. This is moved to a worksheet and graphs are generated from the data. All of this is formatted for printing. In the Macros that are written to do this is a sub macro that takes this Report and saves it to a network drive for uploading and also shows the PDF so you can print it.
The problem: when it creates the PDF it adds a line to the top of the PDF that states "Sample Excel file Saved as PDF". This is also on the saved PDF that will be uploaded as part of file in our HIS.
How do I not get this on the PDF. It is not part of, and should not be on the PDF.



Below is the code I use to setup the PDF save and Print it.



Sub Save_PDF()

Dim Path1 As String
Dim Path2 As String
Path1 = "c:Test Result..."

'Range where spefic file name is placed for this occurance

Path2 = Range("A79")

With ActiveSheet.PageSetup
.Orientation = xlPortrait
.PrintArea = "$A$1:$AE$75"
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
End With

'Setup saves as report and place in drive for upload to HIS

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
filename:=Path1 & Path2, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False






excel vba pdf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 17:25









BigBen

6,3172618




6,3172618










asked Nov 21 '18 at 17:10









Terry BTerry B

1




1








  • 1





    This may not be an Excel issue, but the PDF print driver. Try printing a Word document to a PDF and see if you get something similar. You may have a Freeware software driver and they often append some type of header/footer to printouts until you make the purchase.

    – Rey Juna
    Nov 21 '18 at 17:39











  • Thanks I'll check that out. This is a corporate computer and office suite, with no special addon that I am aware of. The Network has a driver for CutePDF that I sometimes use from Word, or Excel and have never had this issue. I'm using the xlTypePDF from in the VBA. I'm not sure how to call the CutePDF driver from VBA or if I can. I have gone through the Print settings that I know about and there are no headers/footers or odd margins that I can find.

    – Terry B
    Nov 21 '18 at 19:55











  • Recommend recording a macro of your manual Excel print job. See answer below.

    – Rey Juna
    Nov 21 '18 at 20:23














  • 1





    This may not be an Excel issue, but the PDF print driver. Try printing a Word document to a PDF and see if you get something similar. You may have a Freeware software driver and they often append some type of header/footer to printouts until you make the purchase.

    – Rey Juna
    Nov 21 '18 at 17:39











  • Thanks I'll check that out. This is a corporate computer and office suite, with no special addon that I am aware of. The Network has a driver for CutePDF that I sometimes use from Word, or Excel and have never had this issue. I'm using the xlTypePDF from in the VBA. I'm not sure how to call the CutePDF driver from VBA or if I can. I have gone through the Print settings that I know about and there are no headers/footers or odd margins that I can find.

    – Terry B
    Nov 21 '18 at 19:55











  • Recommend recording a macro of your manual Excel print job. See answer below.

    – Rey Juna
    Nov 21 '18 at 20:23








1




1





This may not be an Excel issue, but the PDF print driver. Try printing a Word document to a PDF and see if you get something similar. You may have a Freeware software driver and they often append some type of header/footer to printouts until you make the purchase.

– Rey Juna
Nov 21 '18 at 17:39





This may not be an Excel issue, but the PDF print driver. Try printing a Word document to a PDF and see if you get something similar. You may have a Freeware software driver and they often append some type of header/footer to printouts until you make the purchase.

– Rey Juna
Nov 21 '18 at 17:39













Thanks I'll check that out. This is a corporate computer and office suite, with no special addon that I am aware of. The Network has a driver for CutePDF that I sometimes use from Word, or Excel and have never had this issue. I'm using the xlTypePDF from in the VBA. I'm not sure how to call the CutePDF driver from VBA or if I can. I have gone through the Print settings that I know about and there are no headers/footers or odd margins that I can find.

– Terry B
Nov 21 '18 at 19:55





Thanks I'll check that out. This is a corporate computer and office suite, with no special addon that I am aware of. The Network has a driver for CutePDF that I sometimes use from Word, or Excel and have never had this issue. I'm using the xlTypePDF from in the VBA. I'm not sure how to call the CutePDF driver from VBA or if I can. I have gone through the Print settings that I know about and there are no headers/footers or odd margins that I can find.

– Terry B
Nov 21 '18 at 19:55













Recommend recording a macro of your manual Excel print job. See answer below.

– Rey Juna
Nov 21 '18 at 20:23





Recommend recording a macro of your manual Excel print job. See answer below.

– Rey Juna
Nov 21 '18 at 20:23












1 Answer
1






active

oldest

votes


















0














Recommend you use the same driver here that you use to print manually, since there you have no issues. I recorded a macro for my system below and then added the PrToFileName parameter. Recommend you do the same and integrate it into your code.



Sub TestPrinting()
' TestPrinting Macro

Application.ActivePrinter = "Microsoft Print to PDF on xx01:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Microsoft Print to PDF on xx01:", Collate:=True, IgnorePrintAreas:=False, _
PrToFileName:="C:UsersjunaDesktopTestPDFPrint.pdf"

End Sub





share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417296%2fdelete-header-sample-excel-file-saved-as-pdf%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Recommend you use the same driver here that you use to print manually, since there you have no issues. I recorded a macro for my system below and then added the PrToFileName parameter. Recommend you do the same and integrate it into your code.



    Sub TestPrinting()
    ' TestPrinting Macro

    Application.ActivePrinter = "Microsoft Print to PDF on xx01:"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
    "Microsoft Print to PDF on xx01:", Collate:=True, IgnorePrintAreas:=False, _
    PrToFileName:="C:UsersjunaDesktopTestPDFPrint.pdf"

    End Sub





    share|improve this answer






























      0














      Recommend you use the same driver here that you use to print manually, since there you have no issues. I recorded a macro for my system below and then added the PrToFileName parameter. Recommend you do the same and integrate it into your code.



      Sub TestPrinting()
      ' TestPrinting Macro

      Application.ActivePrinter = "Microsoft Print to PDF on xx01:"
      ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
      "Microsoft Print to PDF on xx01:", Collate:=True, IgnorePrintAreas:=False, _
      PrToFileName:="C:UsersjunaDesktopTestPDFPrint.pdf"

      End Sub





      share|improve this answer




























        0












        0








        0







        Recommend you use the same driver here that you use to print manually, since there you have no issues. I recorded a macro for my system below and then added the PrToFileName parameter. Recommend you do the same and integrate it into your code.



        Sub TestPrinting()
        ' TestPrinting Macro

        Application.ActivePrinter = "Microsoft Print to PDF on xx01:"
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
        "Microsoft Print to PDF on xx01:", Collate:=True, IgnorePrintAreas:=False, _
        PrToFileName:="C:UsersjunaDesktopTestPDFPrint.pdf"

        End Sub





        share|improve this answer















        Recommend you use the same driver here that you use to print manually, since there you have no issues. I recorded a macro for my system below and then added the PrToFileName parameter. Recommend you do the same and integrate it into your code.



        Sub TestPrinting()
        ' TestPrinting Macro

        Application.ActivePrinter = "Microsoft Print to PDF on xx01:"
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
        "Microsoft Print to PDF on xx01:", Collate:=True, IgnorePrintAreas:=False, _
        PrToFileName:="C:UsersjunaDesktopTestPDFPrint.pdf"

        End Sub






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 21 '18 at 21:11

























        answered Nov 21 '18 at 20:21









        Rey JunaRey Juna

        31118




        31118
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417296%2fdelete-header-sample-excel-file-saved-as-pdf%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            'app-layout' is not a known element: how to share Component with different Modules

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            WPF add header to Image with URL pettitions [duplicate]