DickyP
Active member
- Local time
- Today, 10:37
- Joined
- Apr 2, 2024
- Messages
- 251
Being newly joined I've been browsing the forums an noticed that users are regularly being told how to add references. I got bored years ago with the process when creating new databases so wrote the following procedure which I copy into every new database and run from the immediate window (and then delete).
Thought it might possibly be of use and couldn't find the equivalent anywhere else in the forums. I'm running Office 2021 but I've changed it for versions from 2003 onwards.
If you don't recognize them 'scrrun.dll' is need for using the File System Object and 'vbScript.dll\3' for Regular Expressions.
Thought it might possibly be of use and couldn't find the equivalent anywhere else in the forums. I'm running Office 2021 but I've changed it for versions from 2003 onwards.
If you don't recognize them 'scrrun.dll' is need for using the File System Object and 'vbScript.dll\3' for Regular Expressions.
Code:
Public Sub refs()
On Error Resume Next
' =========================================================================================
' Standard Non Built-In References Used in a typical Access Database with Office Automation
' =========================================================================================
With Application.References
.AddFromFile "C:\Program Files\Common Files\Microsoft Shared\OFFICE16\MSO.DLL"
.AddFromFile "C:\Windows\System32\scrrun.dll"
.AddFromFile "C:\Windows\System32\vbscript.dll\3"
.AddFromFile "C:\Program Files\Microsoft Office\root\Office16\MSWORD.OLB"
.AddFromFile "C:\Program Files\Microsoft Office\root\Office16\EXCEL.OLB"
.AddFromFile "C:\Windows\System32\msxml3.dll"
End With
End Sub
Last edited: