Option Explicit
Public Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As LongPtr
Public Declare PtrSafe Function EmptyClipboard Lib "user32" () As LongPtr
Public Declare PtrSafe Function CloseClipboard Lib "user32" () As LongPtr
Public Function ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End Function
Sub ccc()
Call ClearClipboard
End Sub
Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End Sub
'Clearing the Office Clipboard
Dim oData As New DataObject 'object to use the clipboard
oData.SetText text:=Empty 'Clear
oData.PutInClipboard 'take in the clipboard to empty it
'Clearing the Office Clipboard
Dim oData As New DataObject 'object to use the clipboard
oData.SetText text:=Empty 'Clear
oData.PutInClipboard 'take in the clipboard to empty it
'You can also just remove the Alert Messages from the Excel Program while
'the code is running
'Remove alert Messages from the Excel Program when closing
ExcelProgram.DisplayAlerts = False
'Quiting the Excel Application
ExcelProgram.Quit