Results 1 to 3 of 3

Thread: Print excel sheet to a PDF file

  1. #1

    Print excel sheet to a PDF file

    Hello Excel guys, I feel stupid again.

    Ive been trying to get my excel sheet to print to my desktop as PDF as we have a PDF writer as a printer. I have the following code which is terrible im sure but hope you will get my gist. Any ideas?

    Code:
    Sub print2pdf()
                       
        Application.ActivePrinter = "PDF Writer on Ne02:"
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
            "PDF Writer on Ne02:", Collate:=True, PrToFileName:="C:\Documents and Settings\aljacobs\Desktop\Filename.pdf"
                     
    End Sub
    the file does get created to my desktop but it wont open

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    You mean like

    Code:
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, preview:=True, ActivePrinter:= _
            "PDF Writer on Ne02:", Collate:=True, PrToFileName:="C:\Documents and Settings\aljacobs\Desktop\Filename.pdf"
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Thanks Admin but same results as my code. File is written to my desktop but it wont open.

Similar Threads

  1. Printing range of sheets in excel or in PDF
    By excel_learner in forum Excel Help
    Replies: 18
    Last Post: 10-11-2015, 01:36 PM
  2. Open PDF file with PowerPoint VBA
    By bg52ip in forum Powerpoint Help
    Replies: 4
    Last Post: 06-12-2013, 11:28 PM
  3. Replies: 7
    Last Post: 08-08-2012, 10:24 AM
  4. Opening a Pdf file using VBA
    By littleiitin in forum Excel Help
    Replies: 2
    Last Post: 11-30-2011, 03:05 PM
  5. Replies: 1
    Last Post: 06-02-2011, 10:38 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •