Consulting

Results 1 to 5 of 5

Thread: Solved: Excel confirmation messages

  1. #1

    Solved: Excel confirmation messages

    I have a whole big macro that i wrote that part of it copies cells and pastes to another workbook, then it closes the first workbook.
    when i run the macro, the message comes up asking me if i want to save the data in the clipboard before it closes the file.

    How can i eliminate that? i do not want the data saved to the clipboard and i dont want the user having that option.

    Also, when i do a save as using a macro, it asks me if i want to replace the existing file. I want this to always be yes as well, without asking the user.

    Any suggestions of what line of code i can add to take care of this?

  2. #2
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    This will supress all messages from Excel..

    [vba]Application.DisplayAlerts = False
    '..
    '.. code
    '..
    Application.DisplayAlerts = True[/vba]

    If you get the 'save over' message box, it will automatically save over any earlier file. There are functions you can write to check if the file exists.

  3. #3
    this is perfect. i know that the file exists but i want it overwritten so that's exactly what i needed.
    do i put this in the genera statements section, like where i put option explicit, etc. or after the line sub...() and before end sub?

  4. #4
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Sorry, it must be enclosed inside your routine, so Sub(), ..=False, code, ..=True, End Sub.

  5. #5
    Thank you.
    Works 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
  •