+ Reply to Thread
Results 1 to 20 of 20

Save XL to PDF on desktop with cell address

  1. #1
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Save XL to PDF on desktop with cell address

    Hello Again,

    I am trying to save and individual worksheet as PDF on desktop in a new folder. but below script is giving error. It says Run-time error '76': Path not found.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    There will be two "\\" backslash characters after Desktop as opposed to just one. I suggest to remove the & "\" after MyFullName = DTAddress...
    If you like my contribution click the star icon!

  3. #3
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Save XL to PDF on desktop with cell address

    Thanks for our response but problem remain the same.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    What you can do is add a line after the line shown below so you get to see what the actual file name is

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Save XL to PDF on desktop with cell address

    in a message it is displaying a file name not directory name and then file name

  6. #6
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    So then MyFullName is not initialised properly and you should look at the individual components that should make up the path and name.

    Without the actual workbook with the contents I am not able to help you.

  7. #7
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Save XL to PDF on desktop with cell address

    Please find the attached sample file.
    Attached Files Attached Files

  8. #8
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    Observations:

    you are trying to create a directory using the statement below, where the variable MyFullName is blank at this time (not initialised)

    Please Login or Register  to view this content.
    this is where the error message 'Path not found' comes from. It does not even reach the ExportAsFixedFormat line

    I would also add a file extension to the name as shown in the line below

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Save XL to PDF on desktop with cell address

    still remain the same it says path not found

  10. #10
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    What value will MyFullName have when you try to create the directory?

  11. #11
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Save XL to PDF on desktop with cell address

    it a cell address combination of numeric and string from "ART NRP Flat" worksheet

  12. #12
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    I have deleted the mkdir statement and added the & ".pdf". Ran the code without any problems.

    Maybe the below instruction on your PC does not return any value

    Please Login or Register  to view this content.
    check the value in DTAddress by placing a MsgBox DTAddress instruction just below this statement to see the value returned.

  13. #13
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    Ok post the new copy of the workbook

  14. #14
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Save XL to PDF on desktop with cell address

    yes it is converting the sheet into the PDF but i need to make a folder and after converting the sheet into PDF it will be saved in that folder

  15. #15
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    See post #13, please post a copy of the workbook

  16. #16
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Save XL to PDF on desktop with cell address

    i have already attached to my post#7

  17. #17
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    Yes, but you have made changes to it right?

  18. #18
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Save XL to PDF on desktop with cell address

    Please find the sample copy updated
    Attached Files Attached Files

  19. #19
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Save XL to PDF on desktop with cell address

    You have removed the statement for creating a directory. The code to create the PDF works, and the pdf gets placed on the desktop.

    The example code below creates a new directory named "new_directory_name" on the desktop and because the DTAdress varaible is updated, the pdf will be written into this newly created directory

    Please Login or Register  to view this content.

  20. #20
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Save XL to PDF on desktop with cell address

    Thanks a lot for your help it is working as i want. i will check on my original file it i have any issues i will come back to you. Topic marked as closed and reputation added.

+ 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