Results 1 to 2 of 2

Thread: Excel Sheet import to PDF sheet

  1. #1
    Seeker chrisl614's Avatar
    Join Date
    Apr 2019
    Posts
    13
    Articles
    0
    Excel Version
    2016

    Excel Sheet import to PDF sheet



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi
    I have an excel sheet that that I want to be able to import into excel. I don't want to convert the excel sheet to PDF, I want to know if I would be able to import the excel sheet into the PDF form.
    Thank you in advance
    Attached Files Attached Files

  2. #2
    Conjurer Logit's Avatar
    Join Date
    Nov 2016
    Posts
    252
    Articles
    0
    Excel Version
    2007
    .
    Paste the following into a Regular Module :

    Code:
    Option Explicit
    
    Sub PrintTableToPDF()
    'SUBROUTINE: PrintTableToPDF
    'DEVELOPER: Ryan Wells
    'DESCRIPTION: Print a table of your choosing to a PDF
    
    
    Dim strfile As String
    Dim myfile As Variant
    Dim strTable As String, r As Range
    Application.ScreenUpdating = False
    
    
    'Enter the table name you want to save
    strTable = InputBox("What's the name of the table you want to save?", "Enter Table Name") 'Table you want to save
        If Trim(strTable) = "" Then Exit Sub
            'Prompt for save location
            strfile = strTable & "_" _
            & Format(Now(), "yyyymmdd_hhmmss") _
            & ".pdf"
            strfile = ThisWorkbook.Path & "\" & strfile
            
            myfile = Application.GetSaveAsFilename _
            (InitialFileName:=strfile, _
            FileFilter:="PDF Files (*.pdf), *.pdf", _
            Title:="Select Folder and File Name to Save as PDF")
            
                If myfile <> "False" Then 'save as PDF
                    Range(strTable).ExportAsFixedFormat Type:=xlTypePDF, Filename:=myfile, Quality:=xlQualityStandard, _
                    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
                Else
                    MsgBox "No File Selected. PDF will not be saved", vbOKOnly, "No File Selected"
                End If
    
    
    Application.DisplayAlerts = False
    
    
    LetsContinue:
        With Application
            .ScreenUpdating = True
            .DisplayAlerts = True
        End With
    Exit Sub
    End Sub
    You will need to highlight all of the table to be included and give it a name. Go to the INSERT tab on the menu bar and select TABLE. You will click on TABLE after you have highlighted all of the RANGE to be included in the table.

    After creating the Table, give it a name or accept the auto-name. If it is the first one it will be called TABLE1.
    Then run the macro.

    This is the source for the code : https://trumpexcel.com/convert-excel-to-pdf/

    Scroll down a couple of times to : Print One Table To PDF

    Best wishes.

Posting Permissions

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