Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Jul 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Save As- Without Confirmation

    I'm using the Save.As function to save my file to a second folder. It says the file already exists, do I want to replace it. Yes I do. I do this every day, and I want to automate the procedure-just save over the previous file without asking me. Howsabout some suggestions.

    Thanks folks,
    Paul

  2. #2
    calacuccia
    Guest

    Re: Save As- Without Confirmation

    Hi Paul.

    I don't know how well you know VBA, so I presume you do know it.

    You can use a procedure like this:

    Sub MySaveAs()
    Application.DisplayAlerts=False
    ActiveWorkbook.SaveAs "C:MyFolderMyFile.xls"
    Application.DisplayAlerts=True
    End Sub

  3. #3
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Roanoke area, Virginia, USA
    Posts
    3,729
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Save As- Without Confirmation

    wouldn't that be displayalerts = false?

    if your vba skills are not so hot, try this KB for some step by steps:
    http://support.microsoft.com/support/kb/ar...s/q213/4/28.asp

  4. #4
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Roanoke area, Virginia, USA
    Posts
    3,729
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Save As- Without Confirmation

    oops, i see you have both in. the second isn't needed since they are reset to true when the sub ends.

  5. #5
    calacuccia
    Guest

    Re: Save As- Without Confirmation

    Mary,

    The second one is always needed.

    First of all, even when it is reset at the end of the macro (was only the case in previous versions of Excel, with previous meaning prior to XL 97), you can have subsequent commands where you really don't want Excel to accept the default choice when an alert is displayed.

    Second of all, Microsoft puts this in the help file for the DisplayAlerts Method:

    "Remarks

    The default value is True. Set this property to False if you don't want to be disturbed by prompts and alert messages while a macro is running; any time a message requires a response, Microsoft Excel chooses the default response.
    If you set this property to False, Microsoft Excel doesn't automatically set it back to True when your macro stops running. Your macro should always set the property back to True when it stops running.

    Note This behavior is different from previous versions of Microsoft Excel. In earlier versions, the DisplayAlerts property was automatically reset to True when the macro stopped running. If you have old code that relies on this behavior, you should change your code to explicitly set the property back to True at the end of the macro."

    Although it does not seem to work this way, be sure that in a future it will be like this.

    It is in any case a good habitude to always reset manual modifications of Excel behaviour if you do it in a macro.

    Calacuccia

  6. #6
    New Lounger
    Join Date
    Jul 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    I appreciate the help, the code worked perfectly!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •