The creation and customization of database applications using Microsoft Access
Hi @Doug
Thank you for sharing the additional insight. You can try the options below:
Option 1: Add the Library Reference
The DataObject belongs to the Microsoft Forms 2.0 Object Library. To enable it:
- Open the VBA window, then go to Tools > References
- Scroll through the list and locate Microsoft Forms 2.0 Object Library.
- Select the checkbox and click OK.
If it's missing, click the Browse... button in the same window, navigate to C:\Windows\System32\ (or C:\Windows\SysWOW64), locate a file named FM20.DLL, select it, and click Open.
Option 2: Use the “no-reference” approach (late binding)
If you prefer not to depend on library references, especially when sharing the database with others, late binding can help avoid compatibility issues. This approach allows Access to resolve the DataObject at runtime without requiring any manual setup.
You can adjust your code as follows:
Sub CopyListToClipboard()
Dim s As String
s = LoadClipboard("1356, 1360, 1366, 1368")
' Change "As DataObject" to "As Object"
Dim MyData As Object
' Use CreateObject instead of "New"
Set MyData = CreateObject("MSForms.DataObject")
MyData.SetText s
MyData.PutInClipboard
End Sub
If you have any updates, please feel free to share.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.