
hi, D Brown, To add references like Microsoft Forms 2.0 Object Library (for MSForms.DataObject) and Microsoft Scripting Runtime (for FileSystemObject) in Microsoft Access purchased with a Microsoft 365 subscription, follow these steps:Step-by-Step Guide:
Open Microsoft Access:
- Start Microsoft Access and open the database where you want to add the references.
Open the VBA Editor:
- Press `Alt + F11` to open the **Visual Basic for Applications (VBA)** editor.
**Access the References Dialog**:
- In the VBA editor, go to the **Tools** menu at the top.
- Click on **References** from the dropdown.
**Add Microsoft Forms 2.0 Object Library**:
- In the **References** dialog box, look for **Microsoft Forms 2.0 Object Library**.
- If you cannot find it in the list, you may need to browse for it.
- Click on the **Browse** button at the bottom of the References dialog.
- Navigate to the path of the **FM20.DLL** file, which is typically located in one of these directories:
- `C:\Windows\System32\FM20.DLL` (for 32-bit Windows)
- `C:\Windows\SysWow64\FM20.DLL` (for 64-bit Windows)
- After selecting the **FM20.DLL** file, click **Open** to add the library.
**Add Microsoft Scripting Runtime**:
- In the **References** dialog, scroll down and check the box next to **Microsoft Scripting Runtime**.
- This library provides access to **FileSystemObject** and other scripting functions.
**Confirm and Close**:
- After selecting the desired references (Microsoft Forms 2.0 and Microsoft Scripting Runtime), click **OK** to close the References dialog box.
**Write VBA Code Using the References**:
- Now you can use the **MSForms.DataObject** (from **Microsoft Forms 2.0 Object Library**) and **FileSystemObject** (from **Microsoft Scripting Runtime**) in your VBA code. For example:
- For clipboard handling with `MSForms.DataObject`:
```vba
vba
Copia
Dim objData As MSForms.DataObject
Set objData = New MSForms.DataObject objData.SetText "Hello, Clipboard!" objData.PutInClipboard ```
- For working with files using `FileSystemObject`:
```vba
vb
Copia
Dim fso As FileSystemObject
Set fso = New FileSystemObject If fso.FileExists("C:\path\to\file.txt") Then ' Do something with the file End If ```
**Save Your Work**:
- After writing your code, save the VBA project and close the VBA editor by pressing `Alt + Q`.
Notes:
- If you encounter issues finding Microsoft Forms 2.0 Object Library or if it's not available, it might be due to restrictions or differences in the versions of Microsoft Office. In some cases, you may have to manually install or register FM20.DLL.
- The Microsoft Forms 2.0 Object Library is generally available in older versions of Microsoft Office (like Office 2010 or earlier), but its availability may vary in newer versions or installations from Microsoft 365.To add references like Microsoft Forms 2.0 Object Library (for MSForms.DataObject) and Microsoft Scripting Runtime (for FileSystemObject) in Microsoft Access purchased with a Microsoft 365 subscription, follow these steps: Step-by-Step Guide:
- Open Microsoft Access:
- Start Microsoft Access and open the database where you want to add the references.
- Open the VBA Editor:
- Press
Alt + F11
to open the Visual Basic for Applications (VBA) editor.
- Press
- Access the References Dialog:
- In the VBA editor, go to the Tools menu at the top.
- Click on References from the dropdown.
- Add Microsoft Forms 2.0 Object Library:
- In the References dialog box, look for Microsoft Forms 2.0 Object Library.
- If you cannot find it in the list, you may need to browse for it.
- Click on the Browse button at the bottom of the References dialog.
- Navigate to the path of the FM20.DLL file, which is typically located in one of these directories:
-
C:\Windows\System32\FM20.DLL
(for 32-bit Windows) -
C:\Windows\SysWow64\FM20.DLL
(for 64-bit Windows)
-
- After selecting the FM20.DLL file, click Open to add the library.
- Open Microsoft Access:
-
- Add Microsoft Scripting Runtime:
- In the References dialog, scroll down and check the box next to Microsoft Scripting Runtime.
- This library provides access to FileSystemObject and other scripting functions.
- Confirm and Close:
- After selecting the desired references (Microsoft Forms 2.0 and Microsoft Scripting Runtime), click OK to close the References dialog box.
- Write VBA Code Using the References:
- Now you can use the MSForms.DataObject (from Microsoft Forms 2.0 Object Library) and FileSystemObject (from Microsoft Scripting Runtime) in your VBA code. For example:
- For clipboard handling with
MSForms.DataObject
:vba Copia Dim objData As MSForms.DataObject
- Add Microsoft Scripting Runtime:
Set objData = New MSForms.DataObject objData.SetText "Hello, Clipboard!" objData.PutInClipboard ```
- For working with files using `FileSystemObject`:
```vba
vb
Copia
Dim fso As FileSystemObject
Set fso = New FileSystemObject If fso.FileExists("C:\path\to\file.txt") Then ' Do something with the file End If ```
- Save Your Work:
- After writing your code, save the VBA project and close the VBA editor by pressing
Alt + Q
.
- After writing your code, save the VBA project and close the VBA editor by pressing
Notes:
- If you encounter issues finding Microsoft Forms 2.0 Object Library or if it's not available, it might be due to restrictions or differences in the versions of Microsoft Office. In some cases, you may have to manually install or register FM20.DLL.
- The Microsoft Forms 2.0 Object Library is generally available in older versions of Microsoft Office (like Office 2010 or earlier), but its availability may vary in newer versions or installations from Microsoft 365.
I hope I have been of help