I'm not sure if this is what you want, but I wrote this VBA module to automatically add a reference in Access to the Outlook object library.
Function AddOutlookOleObjectLibrary() As String
' This subroutine automatically adds the Microsoft Outlook 9.0 Object Library
Dim r As Reference, r1 As Reference
Dim s As String, bExists As Boolean
bExists = False
For Each r In Application.References
If r.Name = "Outlook" Then
bExists = True
Exit For
End If
Next
If bExists Then
AddOutlookOleObjectLibrary = "Outlook Library References already exist."
Else
'Get file location
s = SysCmd(acSysCmdAccessDir) & "Msoutl9.olb"
' Add the Reference for The Outlook Object Library
References.AddFromFile s
For Each r In Application.References
If r.Name = "Outlook" Then
AddOutlookOleObjectLibrary = "Outlook Library References Added."
End If
Next
End If
End Function
This is part of a larger module ("Access 2000 SendMessage Function" you can view and download from my computing page.
Does any one knows how to open Access (2000) databse from VB project without having MS Access Installed on the computer?
I have beeb told to make a reference to "Microsoft Access 10.0 Object Library", but the project still giving me "ActiveX component can not create object" and here is the code:
Function OLEOpenReport(strDBName As String, _
strRptName As String, Optional ByVal intDisplay As Variant, Optional ByVal strFilter As Variant, Optional ByVal strWhere As Variant) As Boolean
On Error GoTo OLEOpenReport_Err
' Create Automation object.
Dim objAccess As Object
Set objAccess = CreateObject("Access.Application"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.