Problem with Access 2010 vba clipboard

Asked By 0 points N/A Posted on -
qa-featured

How do I manipulate Access 2010 vba clipboard? Please suggest.

SHARE
Answered By 0 points N/A #161806

Problem with Access 2010 vba clipboard

qa-featured

After doing some research for your question, I have found the following:

Clear the clipboard in VBA:

Dim MyData As DataObject

Set MyData = New DataObject
MyData.SetText ""
MyData.PutInClipboard

Get text on clipboard into a string variable:

Dim MyData As DataObject
Dim strClip As String

Set MyData = New DataObject
MyData.GetFromClipboard
strClip = MyData.GetText

Get text from string variable onto clipboard:

Dim MyData As DataObject
Dim strClip As String
strClip = "Hi there"

Set MyData = New DataObject

MyData.SetText strClip 
MyData.PutInClipboard

The DataObject object is a part of the Forms library in VBA.  In order for these codes to work, you would need to either Have at least one UserFormin your project, or in the VBA editor do the following:

go to Tools – References – and set a reference to the "Microsoft Forms 2.0 Object Library".

Related Questions