I'm taking a screenshot using an API call. The problem is, that screenshot will stay on the clipboard and Application.CutCopyMode = False
only works if you've copied something straight from Excel.
One workaround is to just copy something in Excel after taking the screenshot and then using Application.CutCopyMode
, but if there is a more official way of doing this it would be helpful. So far I have tried the following but it didn't work
Sub clear()
Dim db As MSForms.DataObject
db.clear
End Sub
Create a module called globals and put these there.
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
Then use this code from wherever.
OpenClipboard (0&)
EmptyClipboard
CloseClipboard