ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Easy-Selecting "No" from message box (https://www.excelbanter.com/excel-programming/344391-easy-selecting-no-message-box.html)

tobriant[_3_]

Easy-Selecting "No" from message box
 

Witin my code, I am opening a workbook and copying a selection of data.
I do not make any modifications to the workbook, and subsequently close
the file. Does anyone have the code that will allow me to select the
"No" option of the message box that opens when closing that asks if you
would like to store information on the clipboard?

thanks


--
tobriant
------------------------------------------------------------------------
tobriant's Profile: http://www.excelforum.com/member.php...o&userid=25155
View this thread: http://www.excelforum.com/showthread...hreadid=480867


Leith Ross[_181_]

Easy-Selecting "No" from message box
 

Hello Tobriant,

Copy and paste this macro into a VBA project module.

CALLING THE MACRO:
ClearClipboard


Code:
--------------------
Declare Function OpenClipboard _
Lib "User32.dll" _
(ByVal hWndNewOwner As Long) As Long

Declare Function EmptyClipboard _
Lib "User32.dll" () As Long

Declare Function CloseClipboard _
Lib "User32.dll" () As Long

Public Sub ClearClipboard()

Dim Ret

Ret = OpenClipboard(0&)
If Ret < 0 Then
Ret = EmptyClipboard
End If
CloseClipboard

End Sub

--------------------

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=480867



All times are GMT +1. The time now is 04:36 AM.

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