Access to the Nth clipboard element

Is there a way to get multiple items from the clipboard? I am using something like this:

Dim clipboard As MSForms.DataObject
Dim str1 As String
Dim str2 As String

Set clipboard = New MSForms.DataObject

clipboard.GetFromClipboard
str1 = clipboard.GetText(1)
str2 = clipboard.GetText(2)

However, I get an error when I assign a value to my second variable, which says the following:

  Run-time error '-2147221404 (800040064)':
  DataObject:GetText Invalid FORMATETC Structure

Help is much appreciated!

+4
source share
1 answer

Turns out there are two clipboards: the Windows clipboard and the Office clipboard.

The Office clipboard can contain up to 24 elements (all can be of the same type), while the Windows clipboard can contain only one element of each type.

  • Copying to the Windows clipboard is as simple as selecting, then typing Ctrl-C.
  • Office , Ctrl-CC. Office Office, .

VBA MSForms.DataObject Windows, . , ///, Office VBA.

, VBA. () , , (, ). , .

interwebz Office, Excel-to-Word. , VBA / // / .

+1

All Articles