+ Reply to Thread
Results 1 to 3 of 3

Macro to create PDF's

Hybrid View

eoghanmolloy Macro to create PDF's 04-16-2018, 11:16 AM
AlphaFrog Re: Macro to create PDF's 04-16-2018, 12:02 PM
eoghanmolloy Re: Macro to create PDF's 04-17-2018, 09:08 AM
  1. #1
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    195

    Macro to create PDF's

    Hi,

    I have an Excel Workbook with c. 200 worksheets.

    Is there a macro I can use that will create a PDF per worksheet, saved as per the name of the worksheet and saved onto my desktop?

    Thanks
    Eoghan

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Macro to create PDF's

    Sub Save_Sheets_PDF()
        
        Dim strPath As String
        Dim ws As Worksheet
        Dim counter As Long
        
        strPath = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\PDF Sheets\"
        If Not Len(Dir(strPath, vbDirectory)) Then MkDir strPath
        
        For Each ws In Worksheets
            If ws.UsedRange.Count > 1 Then
            
                ws.ExportAsFixedFormat _
                   Type:=xlTypePDF, _
                   Filename:=strPath & ws.Name & ".pdf", _
                   Quality:=xlQualityStandard, _
                   IncludeDocProperties:=True, _
                   IgnorePrintAreas:=False, _
                   OpenAfterPublish:=False
                   
                counter = counter + 1
            End If
        Next ws
        
        MsgBox counter & " files saved.", vbInformation, "PDF Files Save Complete"
        
    End Sub
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    195

    Re: Macro to create PDF's

    This is great. Thank you very much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to create a dynamic macro that will create pivot table
    By thlee1122 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2015, 11:49 PM
  2. How to create a macro to create a pivot table on a new sheet
    By thlee1122 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2015, 11:14 AM
  3. Create VBA Macro to create new rows according to data between Sheet1 and Sheet2
    By kcarth in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2015, 02:06 PM
  4. Create a macro to create a pivot table in a worksheet
    By Triscia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2015, 10:53 AM
  5. Macro to find a word in a cell, create a transparent text zone over it, create a hyperlink
    By martin brandl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-17-2015, 03:24 PM
  6. Replies: 1
    Last Post: 07-23-2014, 04:33 AM
  7. Replies: 7
    Last Post: 05-17-2012, 03:08 AM

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