+ Reply to Thread
Results 1 to 20 of 20

PDF to File Folder

  1. #1
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    PDF to File Folder

    Hello,

    I have file folder on my desktop:

    C:\Users\William\OneDrive\Desktop

    I entered this in the Admin sheet in cell L7

    How can the code save to this file?

    Thank you for your help


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello, try this !


    According to your attachment a VBA demonstration for starters :

    PHP Code: 
    Sub Demo1()
            
    Project_Generate
       With Projects
           
    .ExportAsFixedFormat 0, [Admin!L7&IF(RIGHT(Admin!L7,1)="\","","\")] & .[F2] & "_Project_" & .[N2], 0, , , , , 1
       End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 08-23-2023 at 06:24 AM. Reason: misread ...

  3. #3
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    I want cell L7 to have the ability to change file location. I should have mentioned that sorry.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: PDF to File Folder


    I misread, post #2 edited accordingly …

  5. #5
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    I want to be able to change the file location for the PDF. So can cell L7 have the file location for the code?

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: PDF to File Folder


    If by 'file location' you mean only 'directory' or 'folder' like in your attachment so yes as you can yet see within post #2 …

  7. #7
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    I ran the code and it created the PDF but did not save to the file specified.

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: PDF to File Folder


    So where ?!

  9. #9
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    The folder is empty so it seems to not be saving the PDF.

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: PDF to File Folder


    Check at least where the generated pdf file is saved !

    Try with a local folder like for example C:\Tests\ whatever if only it already exists …

  11. #11
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    It is saving in:

    C:\Users\William\OneDrive\Desktop

    I need to change to:

    C:\Users\William\OneDrive\Desktop\Construction

    The folder name was missing.

  12. #12
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    Now it works!

    Thank you very much sir.

    I have one request please. Is there a way to not have the PDF open but just save to the folder? I do not need to view the PDF.
    Last edited by billy60; 08-23-2023 at 07:04 AM.

  13. #13
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    Why does this go to debug?








    Please Login or Register  to view this content.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,007

    Re: PDF to File Folder

    I had removed the SOLVED tag so that you could get help - you have added it back again. I've removed it once more: if you add it back again before you get a response, don't be surprised if you don't get any further help.

    I shall not be intervening with it again.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  15. #15
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    Very sorry to have troubled you. I decided to figure it out on my own this time. Have a nice day.

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,007

    Re: PDF to File Folder

    You haven't troubled me at all.

  17. #17
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: PDF to File Folder


    Quote Originally Posted by billy60 View Post
    Why does this go to debug?
    Bad logic so just compare the FileName variable content with what it must be in order you see what is obviously missing !

  18. #18
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    Okay obviously it has issues.

    Can the code you provided not allow the PDF to open just save to file directory?

  19. #19
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: PDF to File Folder


    Did you find at least the obvious missing in your bad filepathname ?

    As your initial post code open the pdf file after saving it !
    Anyway according to the VBA help - just read it ! - you can just delete , , , , , 1 at the end of .ExportAsFixedFormat codeline …

  20. #20
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    1,271

    Re: PDF to File Folder

    Thanks once again for your help. No I did not figure out the filepathname issue.

+ 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] Save file to users Temp folder, attach it to email then Kill file from temp folder
    By MagicMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-18-2022, 09:13 AM
  2. Creating a folder and saving file within Folder (Naming convention within file)
    By alex900_6 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 03-06-2021, 06:34 PM
  3. move files from Source Folder to Destination Folder, based on file name & Path
    By seenai in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2020, 09:29 AM
  4. [SOLVED] Trouble Updating a list of Files if a file no longer exists in the Folder/Sub Folder Dir.
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-26-2019, 02:03 AM
  5. Create Folder & Check if Folder Exists if Not Create Folder & then Save File
    By Quivolt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2017, 05:31 AM
  6. Replies: 6
    Last Post: 08-11-2006, 03:41 PM
  7. [SOLVED] macro to move from file to file, folder to folder
    By davegb in forum Excel General
    Replies: 0
    Last Post: 01-21-2005, 04:06 PM

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