+ Reply to Thread
Results 1 to 7 of 7

Add Instruction Code For NO or CANCEL within ActiveWorkbook.SaveAs

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Add Instruction Code For NO or CANCEL within ActiveWorkbook.SaveAs

    Hi all,

    When my code runs, it tries to create individual booklets from each sheet.
    If a booklet exists with the same name of the booklet its trying to create, a
    message window pops up, giving the user the option to select from (SAVE,NO,CANCEL).

    If the user selects SAVE, it overwrites the existing file.
    If the user slects NO, the code errors out.
    If the user selects CANCEL, the code errors out.

    I need some code that will be able to handle the NO and CANCEL operations.

    I'm struggling on adding this to my code.

    I'd like for there to be a SAVE_AS if the user selects NO.
    I'd like for there to be a Exit Sub, if the user selects CANCEL

    Please Login or Register  to view this content.

    Any help with this is greatly appreciated.


    BDB
    Last edited by bdb1974; 02-26-2010 at 05:19 PM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Add Instruction Code For NO or CANCEL within ActiveWorkbook.SaveAs

    You could try
    Please Login or Register  to view this content.
    A bit crude but it works

    This could be could be integrated with any other error handler you might have
    Last edited by Marcol; 02-26-2010 at 01:10 PM. Reason: If statement added

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

    Re: Add Instruction Code For NO or CANCEL within ActiveWorkbook.SaveAs

    You can try this (completely untested):
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Add Instruction Code For NO or CANCEL within ActiveWorkbook.SaveAs

    What should "response" be set as/dim as?

    Also, if I want to Save As with another workbook name this will not give me that option
    or will it?

  5. #5
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Add Instruction Code For NO or CANCEL within ActiveWorkbook.SaveAs

    Thanks SHG,

    I had to make a few minor changes in order for this work.
    See below the highlighted areas.

    Please Login or Register  to view this content.
    This bascially solves my problem with the saving function however, a couple more
    issues arose which I did not foresee.

    1. If I choose Save As, I'd like for the Save As window to open in a specifc folder.
    Namely should be in the path found by "Spath"

    2. The file name "BOM" needs to remain open after the save so another macro can
    reformat the sheet.

    Not sure if I should open a new thread for the related problems or leave this thread open for the time being to get these few inherited problems resolved....

    Thanks,

    BDB
    Last edited by bdb1974; 02-26-2010 at 04:04 PM.

  6. #6
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Add Instruction Code For NO or CANCEL within ActiveWorkbook.SaveAs

    Well, I guess my highlights within the code are not showing up.

    Here's what I changed:

    Application.ActiveWorkbook
    Len(wkbCur.Name) - 4)
    BDB

  7. #7
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Add Instruction Code For NO or CANCEL within ActiveWorkbook.SaveAs


    1. If I choose Save As, I'd like for the Save As window to open in a specifc folder.
    Namely should be in the path found by "Spath"
    This will open the directory for me:

    Please Login or Register  to view this content.
    ....Once I save the file, I still need to resolve keeping the file open for reformating.

+ 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