+ Reply to Thread
Results 1 to 4 of 4

Save worksheets in current folder as .pdf

Hybrid View

  1. #1
    Registered User
    Join Date
    10-27-2010
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    18

    Save worksheets in current folder as .pdf

    I have tried to search here and everywhere it seems but at wits end.

    I have made a .xltm template where I enter the info on one sheet and it populates four other sheets in the workbook. I then save this as a .xlsm in the appropiate folder. the other four sheets I have made a concatenate of the name I want to save the worksheet as a .pdf in the current folder the .xlsm is in.

    For instance, manually, I select the current tab "Site Summary", file> 'save as', change the file type to .pdf and enter the name (which I already have in 'B19)' and it saves this to the current folder. I can make the macro button on the page, but not the vba to automate to add to the button. I need to make these macros at the template level so when saved to the specific folder, that is where it will save to.

    I will not show my ignorance on what my attempts have been, but would like to have someone walk me through one sheet as described above and I can learn to do the other three sheets.

    I am using Win7 and Outlook 2010

    I do this upteen times a day, would love to free some of my time up....any one willing to help?

    Ken

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Save worksheets in current folder as .pdf

    Sub export_To_Pdf() 
    strFilePath = "D:\test\" ' <<<<<<<<< to be changed
     Application.ScreenUpdating = False
    On Error Resume Next
    For j = 1 To Sheets.count
      strPdfName = Sheets(j).Name
      Sheets(j).Copy
      ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFilePath & strPdfName, _
      Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
      OpenAfterPublish:=False
           
      ActiveWorkbook.Close (False)
    Next
    Application.ScreenUpdating = True
    End Sub
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    10-27-2010
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Save worksheets in current folder as .pdf

    Thank-you for the reply Patel45,

    Going to give that a go...

    Will be back with admiration or less hair! lol

  4. #4
    Registered User
    Join Date
    10-27-2010
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Save worksheets in current folder as .pdf

    I have finally put together a working code and added it naming one of the files after a specified cell. Thanks again for the head start patel45. Here is the (sloppy) code;

    Sub sendpdf01()
    '
    ' sendpdf01 Macro save in current folder with a cell naming the file
    '
    
    Dim FileName As String
    
    FileName = ThisWorkbook.Path & "\" & Range("h9").Text & ".pdf"
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName, _
            Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
            :=False, OpenAfterPublish:=False
        
        
    End Sub

+ 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