Results 1 to 5 of 5

Autoname .PDF conversion to the name of the .xlsb from which it came

Threaded View

  1. #1
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Autoname .PDF conversion to the name of the .xlsb from which it came

    I have a macro (see code below) that automatically converts the print area of the a worksheet into a pdf file, and then automatically saves the PDF into a specified location, and finally saves the portion of the excel file that affected the print area.

    Right now I have to specifically name "filename" whatever I want the PDF to be saved as. Since I have to replicate my workbook several times, it would be very convenient if the code could autoname the PDF with the same name as the .xlsb file from which it was made. For instance, if the excel file's name is "Doe, John.xlsb", then the code auto saves the PDf as "Doe,John.pdf" when that macro is clicked. This would save a tremendous amount of time of renaming "filename" for 80 people for 26 pay cycles (2080 times!).


    
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
            "G:\Timesheets\PDF Archive\FY2012\27 = 061712 - 063012\filename.pdf", _
            Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
            :=False, OpenAfterPublish:=False
        Range("A1:O1").Select
        ActiveWorkbook.Save
    Last edited by jonvanwyk; 06-06-2011 at 02:20 PM.

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