+ Reply to Thread
Results 1 to 15 of 15

Export as PDF (with specific file name) not working

  1. #1
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Export as PDF (with specific file name) not working

    Hi all,

    I have this code (not sure from which thread) which
    can export my worksheet with specific file name & folder
    (according to date and part type). I tried to put
    it in my worksheet but it's not working.

    Please Login or Register  to view this content.
    and it's highlighted at following part

    Please Login or Register  to view this content.
    I received this error from the message box
    Run-time error '1004'

    Document not saved. The document may be open,or an error may have been encountered when saving.


    Really appreciate your help.

    Thank you in advance

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Export as PDF (with specific file name) not working

    Can you save the file as a pdf with that folder path/filename manually?

  3. #3
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Export as PDF (with specific file name) not working

    Dear ragulduy,

    Sorry the formula works well actually & I found my mistake :
    The macro can't find the actual file directory because I moved this macro file
    to a different folder.

    Thank you anyway for your quick feedback

  4. #4
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Export as PDF (with specific file name) not working

    Dear ragulduy,

    Sorry to trouble you, actually I need to change the folder :

    Please Login or Register  to view this content.
    to same folder as the workbook (need to change the first E:\Test| folder to "Summary" folder

    Thank you in advance

  5. #5
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Export as PDF (with specific file name) not working

    Dear ragulduy,

    Sorry to trouble you, actually I need to change the folder :

    Please Login or Register  to view this content.
    to same folder as the workbook (need to change the first E:\Test| folder to "Summary" folder

    Thank you in advance

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Export as PDF (with specific file name) not working

    Please Login or Register  to view this content.
    will give you the name of the folder the activeworkbook is saved in (although you may need to add an additional \ to the end.

  7. #7
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Export as PDF (with specific file name) not working

    Thank you for your guide ragulduy,

    I also need the macro to create the folder if the folder not yet been created, is it possible to combine
    with present script ?

    Please Login or Register  to view this content.
    Thank you in advance

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Export as PDF (with specific file name) not working

    This will create the folder if it does not already exist:
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Export as PDF (with specific file name) not working

    Sorry ragulduy,

    I'm still learning this vba script, where should I put the script
    in my present code?

    Thank you in advance

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Export as PDF (with specific file name) not working

    Please Login or Register  to view this content.
    I'd probably do it like that.

  11. #11
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Export as PDF (with specific file name) not working

    Dear ragulduy,

    I received syntax error & it's highlighted at :
    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Export as PDF (with specific file name) not working

    Oops sorry, remove the dim before fso, that line should be
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Export as PDF (with specific file name) not working

    Dear ragulduy,

    Thank you for your reply.

    Received error message box :
    Runtime error : 1004

    with highlight on :
    Please Login or Register  to view this content.
    Thank you in advance

  14. #14
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Export as PDF (with specific file name) not working

    What is the value of foldername at that point?

  15. #15
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Export as PDF (with specific file name) not working

    Dear ragulduy,

    Sorry for late reply,

    I don't understand :
    What is the value of foldername at that point?
    Is it the name of the folder, if it is , the folder name consists of two
    phrases (eg: new record) and usually it's text only (without numbers or character)

+ 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] Export CSV file in Specific naming format
    By momer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2013, 06:08 PM
  2. [SOLVED] I need to export specific columns to a pipe delimiter file instead of entire worksheet.
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2013, 03:50 PM
  3. Macro to export specific range of data to text file for each worksheet
    By sonofamonkey10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2013, 05:43 PM
  4. VBScript, export file to call date specific
    By andy.k in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-05-2013, 09:44 AM
  5. Replies: 3
    Last Post: 08-28-2012, 09:56 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