June7, Had some time to throw something a bit more concise today (Was at work and a bit tight for time.
A small note, to call the sub/function in outlook, it must exist in thisoutlooksession, I have tried calling it from another module within outlook and that did not work.
Outlook sub - purely to test
Code:
Private Sub Application_Startup
'Allows you to access the items in thisoutlloksession, it does not have to contain any commands
End Sub
Sub test()
Msgbox "This is an outlook sub called by access"
End Sub
Access
Code:
Private Sub Olinteract
dim objOl as Object 'Outlook Object
Dim NewOl as Boolean ' Flag to tell whether a new outlook instance was created
Set objOl = GetObject(, "Outlook.Application") 'Check if an existing Outlook object is open
If objOl Is Nothing Then
'Open Outlook if it isn't Open
Set objOl=createObject("Outlook.Application")
NewOl=True
End If
objOl.test
If NewOl=true then objOl.Quit
set objOl=Nothing
End Sub
I can't upload a db at the moment but will try to remember when I get to a machine that will let me.