+ Reply to Thread
Results 1 to 3 of 3

Create a single worksheet as PDF

  1. #1
    Registered User
    Join Date
    09-05-2011
    Location
    Ryther, England
    MS-Off Ver
    Office 365
    Posts
    63

    Create a single worksheet as PDF

    Hi guys

    I'm looking for some help with a database I have.

    My database has various worksheets on it. Most of them are feeds and calcs for the main worksheet which outputs data for the user. What I want to do is have the main worksheet only save as a PDF using certain cell references as part of the title.

    I have mastered this to an extent with the coding below. However, the drawback is that it copies the main worksheet as a new workbook, creates the PDF and then leaves the new workbook open. This then needs to be manually closed and discarded. Ultimately I don't need the new workbook and only require the PDF.

    Is there a way of doing this without the extra workbook being created? Any help as always is greatly appreciated

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    09-05-2011
    Location
    Ryther, England
    MS-Off Ver
    Office 365
    Posts
    63

    Re: Create a single worksheet as PDF

    Hi guys

    I've managed to soleve the problem. For anyone else out there who needs the same functionality here is the revised code:

    [code]
    Sub SaveSheet1()

    Dim MyFileName As String

    MyFileName = "Z:\" & Range("L2") & " " & Range("K2") & " " & Format(Date, "ddmmyy") & ".pdf"
    ActiveSheet.PageSetup.PrintArea = "$A$1:$L$27"
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=MyFileName _
    , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
    :=False, OpenAfterPublish:=False

    End Sub
    [\code]

  3. #3
    Registered User
    Join Date
    09-05-2011
    Location
    Ryther, England
    MS-Off Ver
    Office 365
    Posts
    63

    Re: Create a single worksheet as PDF

    And apologies for not posting the code correctly. A mistype!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1