+ Reply to Thread
Results 1 to 8 of 8

Macro to save file by employee and save as PDF in path

  1. #1
    Forum Contributor
    Join Date
    11-26-2010
    Location
    usa
    MS-Off Ver
    Office 365
    Posts
    1,224

    Macro to save file by employee and save as PDF in path

    Hi all

    I am wondering if its possible to have a macro go down a list of employee names and save the file (multiple tabs) in a PDF format on a path on my c:drive?

    Here is my request
    1) "Employee" tab contains list of employees A2:A6 (my original file contains A2:A108)
    -> I would like the macro to go down on by one and change the value in cell E7 on the "Summary" tab (this will update the data points on the Summary, WIP Table, AR Table)
    2) Take the tabs "Summary", "WIP Table" and "AR Table" and save as "PDF" format in a single file
    3) Save the files by Employee name + Current month on a path on my c:drive

    All my data/formulas have been updated, so I simply need a macro that can accomplish the above? There are 107 employees in total, so there should be 107 employee PDF version files.

    I have attached a sample, with just 4 employee names....can someone pls help? FYI: I would like the macro to be smart enough to execute based on the # of names listed in the "employee" tab

    Thank you so much in advance!
    Attached Files Attached Files
    Last edited by jw01; 05-18-2017 at 01:31 PM.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Macro to save file by employee and save as PDF in path

    You may need to play with margins or print settings a little... the first page was spilling over into page 2, but this should get you going:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    11-26-2010
    Location
    usa
    MS-Off Ver
    Office 365
    Posts
    1,224

    Re: Macro to save file by employee and save as PDF in path

    Quote Originally Posted by Arkadi View Post
    You may need to play with margins or print settings a little... the first page was spilling over into page 2, but this should get you going:

    Please Login or Register  to view this content.
    Hi Arkadi

    Wow this is awesome, when I placed your macro in my original file, it only did the first two people and then stops (no errors or anything). In addition, for the file name, it shows the person name but does not show current month, rather "January"?

    THoughts? thanks a million!

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Macro to save file by employee and save as PDF in path

    Ooops! did a quick test with just 2 names, and didn't change it back : For i = 2 To 3 should be For i = 2 To lr

    didn't even notice the month issue... apologies, replace

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.
    Edit: you may want to change the openafterpublish attribute to false once you are doing a bunch of files... I wasn't sure if you want them to open or not.
    Last edited by Arkadi; 05-17-2017 at 04:18 PM.

  5. #5
    Forum Contributor
    Join Date
    11-26-2010
    Location
    usa
    MS-Off Ver
    Office 365
    Posts
    1,224

    Re: Macro to save file by employee and save as PDF in path

    Quote Originally Posted by Arkadi View Post
    Ooops! did a quick test with just 2 names, and didn't change it back : For i = 2 To 3 should be For i = 2 To lr

    didn't even notice the month issue... apologies, replace

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.
    Edit: you may want to change the openafterpublish attribute to false once you are doing a bunch of files... I wasn't sure if you want them to open or not.
    Sweet...that worked out great.

    Just one more thing...for some strange reason, the file is saving with the month being listed before and after the name as well?
    e.g. "MayBeattie, Kent - May"

    Im looking at the code but not sure why it's replicating the month twice? thank you so much!

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Macro to save file by employee and save as PDF in path

    That is odd.... I dont see why.... Can you post an exact copy of the line you are using in your code for the ExportAsFixedFormat?

  7. #7
    Forum Contributor
    Join Date
    11-26-2010
    Location
    usa
    MS-Off Ver
    Office 365
    Posts
    1,224

    Re: Macro to save file by employee and save as PDF in path

    Quote Originally Posted by Arkadi View Post
    That is odd.... I dont see why.... Can you post an exact copy of the line you are using in your code for the ExportAsFixedFormat?
    Hi Arkadi

    Please Login or Register  to view this content.
    I have the above code and couple of things:
    1) the file that is being saved is as follows: "MayEllis, Mark - May"
    2) The path I have shown above i.e. folder is May, the files are saved in PDF folder vs. PDF->May (one folder before).

    Thoughts? thanks for your super awesome help!!!

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Macro to save file by employee and save as PDF in path

    The reason is that the path needs to end in a "\" before the filename, there are 2 options, choose ONE of the changes below (change in red):

    Please Login or Register  to view this content.
    OR:


    Please Login or Register  to view this content.

+ 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. [SOLVED] Macro to save file to path automatically
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2015, 06:08 AM
  2. [SOLVED] Save file as macro-enabled with path and file name from a cell
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2015, 11:51 PM
  3. Save using macro file path
    By RANDY LIPOSKY in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2014, 11:10 AM
  4. Save As macro with only partial file path
    By jake.newport in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2013, 03:42 PM
  5. how to specify a file save path to a save macro
    By Solidstan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-04-2013, 05:33 PM
  6. [SOLVED] VBA for file save as macro enabled to a specifi path and folders
    By stpeter in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2013, 03:41 PM
  7. Macro to save sheet as CSV using a dynamic file name and file path
    By chris.tinta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2013, 10:45 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