ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to 'click OK button' automatically in excel (https://www.excelbanter.com/excel-programming/282107-how-click-ok-button-automatically-excel.html)

Net Whittington

How to 'click OK button' automatically in excel
 
Help!! This is driving me mad and I cannot find a code anywhere to do it

I have macros that open and close spreadsheets / copy large areas of data and I get the normal "Do you want to save your changes?" and "Do you want to keep the information on the clipboard?" dialogue boxes appearing

What I want my macro to do is to say "Yes" or"No" automatically - without any user interaction (as the answer to these questions will never change - and to be frank it is damn annoying)

Has anyone any idea? I thought I was OK at writing macros until this!!!

Ta very muc
Net



libby

How to 'click OK button' automatically in excel
 
To get rid of the "Do you want to save changes" prompt
try this


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Thisworkbook.saved = true 'this closes without saving
application.cutcopymode = false
End Sub

-----Original Message-----
Help!! This is driving me mad and I cannot find a code

anywhere to do it!

I have macros that open and close spreadsheets / copy

large areas of data and I get the normal "Do you want to
save your changes?" and "Do you want to keep the
information on the clipboard?" dialogue boxes appearing.

What I want my macro to do is to say "Yes" or"No"

automatically - without any user interaction (as the
answer to these questions will never change - and to be
frank it is damn annoying).

Has anyone any idea? I thought I was OK at writing macros

until this!!!!

Ta very much
Net


.


Net Whittington

How to 'click OK button' automatically in excel
 
Libb

Thanks - Brilliant - It works! - Sanity has been preserved !!!!

Cheer
Net


All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com