Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://stackoverflow.com/a/51371876/5079799

https://stackoverflow.com/a/49868108/5079799
https://docs.microsoft.com/en-us/office/vba/Language/Concepts/Getting-Started/64-bit-visual-basic-for-applications-overview

#If VBA7 Then
'Code is running VBA7 (2010 or later).

     #If Win64 Then
     'Code is running in 64-bit version of Microsoft Office.
     Private Declare PtrSafe Function OpenClipboard Lib "User32" (ByVal hwnd As Long) As Long 
     Private Declare PtrSafe Function CloseClipboard Lib "User32" () As Long
     #Else
     'Code is running in 32-bit version of Microsoft Office.
     Private Declare Function OpenClipboard Lib "User32" (ByVal hwnd As Long) As Long 
     Private Declare Function CloseClipboard Lib "User32" () As Long
     #End If

#Else
'Code is running VBA6 (2007 or earlier).

#End If
Public Sub ClipboardTest()

 OpenClipboard 0

  ' ~the action that would make Excel clear the clipboard~

 CloseClipboard

End Sub
  • No labels