MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Removing Excel promits from a macro


Posted by Angie on January 24, 2001 3:13 PM

Hi
I am writing a macro that will split text from a database file in to a formatted excel spreadhseet. I can write the macro so that it works, but excel keeps asking me questions (like do i want to clear my clipboard). Is there anyway i can program a response in to the macro so that it doesnt ask me these questions (for example i never want to keep the clipboard info, so it just enters 'no' rather than me having to).

Thanks


Posted by Greg on January 24, 2001 3:42 PM

Application.DisplayAlerts = False
Workbooks("BOOK1.XLS").Close
Application.DisplayAlerts = True

If you don't set the alerts back to true at the end of the macro, or in you error handling, the alerts are turned off and excel will not ask you them again until you turn them back on.

Posted by Angie on January 24, 2001 4:20 PM

Worked like a charm :)