copy string to clipboard

cpampas

Registered User.
Local time
Yesterday, 16:31
Joined
Jul 23, 2012
Messages
221
hello,
Is there a way to copy a string to the clipboard, and after that to be able to press the keys ctrl+V to paste it ?
 
hello,
Is there a way to copy a string to the clipboard, and after that to be able to press the keys ctrl+V to paste it ?
The code the theDBguy and GaP42 suggest works for me without issue. However, to use that code on my 64bit machines, I had to replace "Delcare Function" with "Declare PtrSafe Function". I also had to replace "long" with 'LongPtr". I can't say I understand why that is but that was the answer I found after not being able to make the original code work.

Good luck.
 
A quick Google would reveal a lot of links, one of which would not be affected by the bitness of Access ?


Even if you are affected by the bug mentioned, the API version is also there, amended for bitness.
 
However, to use that code on my 64bit machines
It is not because you have a 64bit machine but because you are using 64bit access.
 
thank you all. I used the code Gasman suggested that works great
 
Code:
Sub WriteToWindowsClipboard(Text As String)
    ' uses a late bound MSForms.DataObject
    With CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
        .SetText Text
        .PutInClipboard
    End With
End Sub
 
Code:
Sub WriteToWindowsClipboard(Text As String)
    ' uses a late bound MSForms.DataObject
    With CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
        .SetText Text
        .PutInClipboard
    End With
End Sub
@MarkK Does using the GUID remove the need to add the MS Forms library?
I had to add it it to test that code and then move it up the hierarchy for the code to work.
 
Yeah, that code I posted should work as is, no need for any references.
 

Users who are viewing this thread

Back
Top Bottom