-
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?
-
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.
-
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?
-
Sorry, it must be enclosed inside your routine, so Sub(), ..=False, code, ..=True, End Sub.
-
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
-
Forum Rules