+ Reply to Thread
Results 1 to 11 of 11

macro to save specific sheet as pdf direct to folder linked via cell

  1. #1
    Forum Contributor
    Join Date
    03-23-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    153

    macro to save specific sheet as pdf direct to folder linked via cell

    hi guys

    i would like to be able to save a specific sheet direct to a folder depending on what is in cell a2

    if i hit the macro button i want it to do the following
    save sheet "specifics" to a folder based on whats in cell a2

    ie to explain

    i have a job file destination as - \\myserver\job_file

    it then needs to look up the folder with whats in a2

    so if a2 has J7777 it would then look up J7777 in \\myserver\job_file
    it would then locate subfolder within that folder called contracts and place that in there as a pdf

    is this possible?
    I look forward to any help.
    i have to be honest and read some of ron de bruins stuff but cannot get my head round it enough to make this work.
    regards

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    Hi,

    Something like this:

    Please Login or Register  to view this content.
    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Contributor
    Join Date
    03-23-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    153

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    hi dom

    thank you for your reply.
    really appreciated.
    oddly enough it worked the first time and i saved if first but now it doesnt and it doesnt come up with an error.

    what i should have said is that whilst it would look up the job folder
    in the example we used ie J7777 it would then have the client name

    so the folder name would be something like J7777 - Smith
    this would affect im sure?
    regards

  4. #4
    Forum Contributor
    Join Date
    03-23-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    153

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    within that job folder J7777 - Smith are several sub folders.
    i need it to locate the contracts folder in that and place said pdf in there

  5. #5
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    As long as the folder name is the same as what is in B2 then it should work fine.

    Afraid I don't have Excel 2007 at work so can't test it.

    Dom

  6. #6
    Forum Contributor
    Join Date
    03-23-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    153

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    surely you mean a2?

  7. #7
    Forum Contributor
    Join Date
    03-23-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    153

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    bizarre cant get it to work now

  8. #8
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    Yes, A2. Did it create a pdf in the required directory when you first ran it then?

    Dom

  9. #9
    Forum Contributor
    Join Date
    03-23-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    153

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    hi dom ive got it working again but not correctly.

    the original workbook is here > \\myserver\contract office documents\STEVES DOCUMENTS\THE NEW JOB FOLDER

    i have the following code in my macro button

    Sub Button10_Click()
    '
    Dim strFileName As String
    strFileName = "\\myserver\job_file\" & Range("a2") & "\contracts\"
    Sheets("PARKING AND ACCESS").ExportAsFixedFormat Type:=xlTypePDF, Filename:=FName, Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=OpenPDFAfterPublish
    End Sub
    but oddly enough it saves it back here \\myserver\contract office documents\STEVES DOCUMENTS\THE NEW JOB FOLDER

  10. #10
    Forum Contributor
    Join Date
    03-23-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    153

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    bump bump bump can anyone help please?

  11. #11
    Forum Contributor
    Join Date
    03-23-2010
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    153

    Re: macro to save specific sheet as pdf direct to folder linked via cell

    please can anyone expert help with this

+ 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