[AccessD] CreateObject to open Outlook

Carolyn Johnson cjlabs at worldnet.att.net
Tue Apr 24 06:58:37 CDT 2007


Access 2000/XP/2003 with Outlook 2003

I have a procedure that creates an email in Outlook using late binding.
The initial code is as follows

    Set objOutlook = GetObject(, "Outlook.Application")
    If Err.Number = 429 Then Set objOutlook =
CreateObject("Outlook.Application")

    Set objOutlookMsg = objOutlook.CreateItem(0)


This code has been working correctly for years until recently.   Now I am
getting the error "Object variable or With block variable not set."    The
error is occuring on the 3rd line -- if Outlook is not open, it correctly
executes the If then statement, but I then get an error on the 3rd line.
If Outlook is already open, the code runs correctly.

This code is still working correctly on my laptop.   The last time I know it
worked on my desktop was several weeks ago.

My laptop has Outlook 2003  SP1.
My desktop has Outlook 2003  SP2.    It's had automated Window updates in
the last couple of weeks.

Does anyone know how to solve this issue, other than opening Outlook first?


Thanks
Carolyn Johnson




More information about the AccessD mailing list