using cell values as folder path

  • Hi Guys,


    I'm trying to alter the below code so that I can save the activesheet in specific folders depending on what is in b12 and b13, but with no avail.
    The save as pdf part works but i cant save it to specific folders that relate to the cell data.


    if someone could help me, that would be great :smile:


    Thanks in advance


  • Re: using cell values as folder path


    Hi carlandtina02
    Welcome to the forum
    The const and file name and path is unclear
    try

  • Re: using cell values as folder path


    Hi Pike,


    Thanks for the welcome and the code!


    I tried the altered code you done, but its not saving in the extended folder path, it saves in "Reports" but not in the folders within it?


    Regards
    Tina :smile:


  • Re: using cell values as folder path


    is Carl.Walker in the folder path?


  • Re: using cell values as folder path


    try this with a check if the folder exists

  • Re: using cell values as folder path


    I just swapped the values in the ranges around as it was only a guess


    try..

  • Re: using cell values as folder path


    Hi Pike,


    Sorry, I feel i'm having your life here :)


    The code is actually creating a folder instead of using the folders that are currently there, and is not naming the file as b16 and h10 value?



  • Re: using cell values as folder path


    if the folder exist it would create a new one
    the folder is the range value
    "C:\Documents and Settings\Carl.Walker\My Documents\Reports" & Range("d12").Value
    the name of the pdf is Range("b12").Value
    you will have to explain what cell does what
    maybe

  • Re: using cell values as folder path


    Hi Pike,


    You've cracked it, this works perfectly now, thanks very much for persevering and all your help! :thanx:


    Just a bit of clarity for anyone else wanting to use this:


    Code
    [COLOR=#333333]strFolder = Range("b12").Value & "\" & Range("d12").Value 'This chooses the folder path from the cell value
    [/COLOR][COLOR=#333333]    strFile = "\" & Range("b16").Value & Range("h10").Value 'This names the file as the cell value [/COLOR]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!