More restrictions like these have creeped into Android over the years.
Clipboard managers like Clipper+ were killed off in the process as they couldn’t access the clipboard while in the background anymore.
Copy aborted!", vbCritical, "API Clipboard Copy" GoTo ExitWithError_ End If ' Clear the Clipboard X = Empt圜lipboard() ' Copy the data to the Clipboard hClipMemory = SetClipboardData(CF_TEXT, hGlobalMemory) ClipBoard_SetData = True If CloseClipboard() = 0 Then MsgBox "Clipboard could not be closed!", vbCritical, "API Clipboard Copy" End If Exit Function ExitWithError_ : On Error Resume Next If Err.Number > 0 Then MsgBox "Clipboard error: " & Err.Android 10 was the first release to severely cut down on clipboard access for apps other than keyboards. Clipboard copy aborted", vbCritical, "API Clipboard Copy" GoTo ExitWithError_ End If ' Open the Clipboard to copy data to If OpenClipboard( 0 &) = 0 Then MsgBox "Clipboard could not be opened. Option Explicit #If VBA7 Then Declare PtrSafe Function GlobalUnlock Lib "kernel32" ( ByVal hMem As LongPtr) As Long Declare PtrSafe Function GlobalLock Lib "kernel32" ( ByVal hMem As LongPtr) As Long Declare PtrSafe Function GlobalAlloc Lib "kernel32" ( ByVal wFlags As LongPtr, ByVal dwBytes As LongPtr) As Long Declare PtrSafe Function CloseClipboard Lib "User32" () As Long Declare PtrSafe Function OpenClipboard Lib "User32" ( ByVal hwnd As LongPtr) As Long Declare PtrSafe Function Empt圜lipboard Lib "User32" () As Long Declare PtrSafe Function lstrcpy Lib "kernel32" ( ByVal lpString1 As Any, ByVal lpString2 As Any) As Long Declare PtrSafe Function SetClipboardData Lib "User32" ( ByVal wFormat As LongPtr, ByVal hMem As LongPtr) As Long # Else Declare Function GlobalUnlock Lib "kernel32" ( ByVal hMem As Long ) As Long Declare Function GlobalLock Lib "kernel32" ( ByVal hMem As Long ) As Long Declare Function GlobalAlloc Lib "kernel32" ( ByVal wFlags As Long, ByVal dwBytes As Long ) As Long Declare Function CloseClipboard Lib "User32" () As Long Declare Function OpenClipboard Lib "User32" ( ByVal hwnd As Long ) As Long Declare Function Empt圜lipboard Lib "User32" () As Long Declare Function lstrcpy Lib "kernel32" ( ByVal lpString1 As Any, ByVal lpString2 As Any) As Long Declare Function SetClipboardData Lib "User32" ( ByVal wFormat As Long, ByVal hMem As Long ) As Long #End If Public Const GHND = &H42 Public Const CF_TEXT = 1 Public Const MAXSIZE = 4096 Public Function ClipBoard_SetData (sPutToClip As String ) As Boolean ' Dim hGlobalMemory As Long Dim lpGlobalMemory As Long Dim hClipMemory As Long Dim X As Long On Error GoTo ExitWithError_ ' Allocate moveable global memory hGlobalMemory = GlobalAlloc(GHND, Len(sPutToClip) + 1 ) ' Lock the block to get a far pointer to this memory lpGlobalMemory = GlobalLock(hGlobalMemory) ' Copy the string to this global memory lpGlobalMemory = lstrcpy(lpGlobalMemory, sPutToClip) ' Unlock the memory If GlobalUnlock(hGlobalMemory) 0 Then MsgBox "Memory location could not be unlocked. Option Explicit Sub CopyTextToClipboardDemo () ' Source: ' Enable Forms Library: VBE>Tools> References>Microsoft Forms 2.0 Object Library>Check Dim oClipboard As MSForms.DataObject Set oClipboard = New MSForms.DataObject oClipboard.SetText Now 'copy current date/time oClipboard.PutInClipboard End Sub Function CopyToClipboard (sClipText As String ) As Boolean ' Source: ' Late binding, no Forms Library reference required Dim MSForms_DataObject As Object On Error GoTo ErrorHandler_ Set MSForms_DataObject = CreateObject( "new:" ) MSForms_DataObject.SetText sClipText MSForms_DataObject.PutInClipboard CopyToClipboard = True Exit Function ErrorHandler_ : CopyToClipboard = False End Function Sub Demo () Debug.Print CopyToClipboard(Now) End Sub Sub GetTextFromClipboardDemo () ' Source: ' Enable Forms Library: VBE>Tools> References>Microsoft Forms 2.0 Object Library>Check Dim oClipboard As MSForms.DataObject Set oClipboard = New MSForms.DataObject oClipboard.GetFromClipboard Debug.Print oClipboard.GetText End Sub