+ Reply to Thread
Results 1 to 10 of 10

Export as Fixed Format macro not getting existing file prompt

  1. #1
    Registered User
    Join Date
    08-20-2009
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Angry Export as Fixed Format macro not getting existing file prompt

    I am using a macro (excel 2007 sp2) to export an excel document of a purchase order to a PDF and saving it to a specific location on the server with the name of the file coming from a cell range to name the file as the purchase order number. The problem is that if the PDF already exists of the same name, I am not getting the prompt to replace the existing file and it is just overwriting the file. Here is the code of my macro:


    Please Login or Register  to view this content.

    I would greatly appreciate any help I can get so I can release this document for use in our office. I just really want to make sure that no files are that easily overwritten.
    Last edited by httdy1; 08-21-2009 at 04:40 PM. Reason: Needed to use tags

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Export as Fixed Format macro not getting existing file prompt

    Welcome to the forum.

    Please take a few minutes to read he forum rules, and then edit your post to add code tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Export as Fixed Format macro not getting existing file prompt

    Thanks.

    Maybe like this:
    Please Login or Register  to view this content.
    Last edited by shg; 08-24-2009 at 02:09 PM. Reason: fixed an error

  4. #4
    Registered User
    Join Date
    08-20-2009
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Export as Fixed Format macro not getting existing file prompt

    I tried the new code and absolutely nothing happens. No PDF is created or anything not even an error message. I just need to create the PDF and have the ability for it to prompt if the file already exists and the yes or no option to replace. Better yet would be a prompt that the file already exists with just an OK option that would stop the creation of the PDF and send you back to the form to correct the number.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Export as Fixed Format macro not getting existing file prompt

    Oops -- try it again.

  6. #6
    Registered User
    Join Date
    08-20-2009
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Export as Fixed Format macro not getting existing file prompt

    Now it is creating the PDF but when the file already exists no prompt appears and it just replaces the file. This is starting to be a tough bug to fix and I apologize that I am a beginner at macros. Would there be a way to get the prompt to just be an OK option to send you back to the form to make the correction? That is once we get the prompt to work at all.

    Thanks.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Export as Fixed Format macro not getting existing file prompt

    Does F5 include the file extension ".pdf" ?

  8. #8
    Registered User
    Join Date
    08-20-2009
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Export as Fixed Format macro not getting existing file prompt

    No, it is just the text that shows the purchase order number. (4000, 4001, 4002 etc...)

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Export as Fixed Format macro not getting existing file prompt

    Try this:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    08-20-2009
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Export as Fixed Format macro not getting existing file prompt

    Yes it worked! Thank you so much. I included the entire code to show the minor changes I made to the prompt message and making it a "OK" only option. This will now force the user to correct the number before being able to create the purchase order PDF.

    Please Login or Register  to view this content.

+ 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