Share via

What reference libraries contain the DataObject object?

Doug 20 Reputation points
2026-05-19T13:30:36.5933333+00:00

What reference libraries contain the DataObject object?

Microsoft 365 and Office | Access | Development
0 comments No comments

2 answers

Sort by: Most helpful
  1. Michelle-N 16,540 Reputation points Microsoft External Staff Moderator
    2026-05-19T14:19:23.7033333+00:00

    Hi @Doug

    Based on your inquiry, I understand that you are looking for the specific VBA reference libraries required to expose and utilize the DataObject object within your project.

    To make it available in your project, you need to link the specific library that contains its definition. Here is exactly how to find and enable it:

    -Add the Microsoft Forms 2.0 Object Library

    The fastest way to gain access to DataObject is by attaching the standard user form control library:

    1. Press Alt + F11 to open the VBA Editor.
    2. In the top menu, navigate to Tools > References.
    3. Scroll down the alphabetical list until you locate Microsoft Forms 2.0 Object Library.
    4. Check the box next to it and click OK.

    If you scroll through the list and notice that the Microsoft Forms 2.0 Object Library is completely missing from your selection menu, it means the library file hasn't been automatically registered by your Office installation. You can load it manually using these steps:

    1. Inside the Tools > References window, click the Browse... button.
    2. Navigate to your computer's system directories depending on your Windows architecture:
      • For 64-bit systems: C:\Windows\SysWOW64\
      • For 32-bit systems: C:\Windows\System32\
    3. Look for the file named FM20.DLL.
    4. Select it, click Open, and ensure it is now checked in your references list.

    Note: If you have ever inserted a UserForm into your current workbook, Excel will automatically reference this library for you


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  

    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.

    Was this answer helpful?


  2. AI answer

    2026-05-19T13:30:47.1033333+00:00

    Several different .NET/COM libraries expose a type named DataObject, depending on the technology being used:

    1. WPF (Windows Presentation Foundation)
      • Type: System.Windows.DataObject
      • Assembly: PresentationCore.dll
      • Namespace: System.Windows
      • Used for: Clipboard, drag-and-drop, and general data transfer in WPF.
    2. Windows Forms
      • Type: System.Windows.Forms.DataObject
      • Assembly: System.Windows.Forms.dll
      • Namespace: System.Windows.Forms
      • Used for: Clipboard and drag-and-drop in WinForms (referenced indirectly in the SQL Server Object Explorer drag handler example).
    3. InfoPath (COM interop)
      • Type: Microsoft.Office.Interop.InfoPath.DataObject
      • Assembly: Microsoft.Office.Interop.InfoPath.dll
      • Namespace: Microsoft.Office.Interop.InfoPath
      • Type: Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject
      • Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust.dll
      • Namespace: Microsoft.Office.Interop.InfoPath.SemiTrust
      • Used for: Accessing InfoPath data sources via COM interop.
    4. VBA/Forms (Office/VBE COM interop)
      • Interface: Microsoft.Vbe.Interop.Forms.DataObject
      • Assembly: Microsoft.Vbe.Interop.Forms.dll
      • Namespace: Microsoft.Vbe.Interop.Forms
      • Class implementation: Microsoft.Vbe.Interop.Forms.DataObjectClass
      • Used for: Clipboard/data transfer in VBA UserForms and related COM scenarios.

    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.