Learn how to a build a cloud-first strategyRegister Now


late binding in vba doesn't work

Posted on 2009-04-21
Medium Priority
Last Modified: 2013-11-27
hi experts,

Why is MS always the troublemaker.
I use the attached code for late binding in order to avoid differences in versions of the reference to outlook.
It is used in an access front-end-application, local installed on several workstations (3) with different office versions. The backend mdb is on a server. There is no reference to outlook when the code starts running.
At home on a laptop this code works fine. But not on the 3 workstations: automation error on the createobject line. What is wrong

Dim myolApp As Object
    Dim MyItem As Object
    'Specify error handler
    On Error GoTo SMError
    Set myolApp = CreateObject("Outlook.Application")
    Set MyItem = myolApp.CreateItem(olMailItem) 'olMailItem

Open in new window

Question by:corhaveman
  • 4
  • 3
LVL 93

Expert Comment

by:Patrick Matthews
ID: 24196334
Are you absolutely certain that Outlook is installed on all machines running the front end?  (Sorry, had to
ask :)

That line is exactly what you are supposed to do.  BTW, the next line might give you some trouble:

    Set MyItem = myolApp.CreateItem(olMailItem) 'olMailItem

olMailItem is a named constant from Outlook.  If you are using late binding, then you need to have defined
it elsewhere as a constant or variable.  (Numeric value is zero...)
LVL 65

Expert Comment

ID: 24196401
Just to verify, as part of your late binding, you have unchecked the reference right?

Author Comment

ID: 24196471
matthewspatrick: at least on the machine I try to figure out the problem outlook is installed
rockiroads:the reference to outlook is unchecked
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 24196543
I searched on EE for Run-time error '-2147024770 (8007007e)' (this automation error)
I read this could be meaning a dll is not properly registered. Does that make any sense.
LVL 65

Accepted Solution

rockiroads earned 2000 total points
ID: 24196554
other possibilities might be some security software interfering.
do these other pc's have just one version of office installed?
wondering if specifying servername would make a difference ie localhost
LVL 65

Expert Comment

ID: 24196594
I was just starting up outlook, since Im offline from the company network, it takes ages to start up!
I wanted to check to see if there was a detect and repair, Im wondering whether this will help resolve any installation issues.
there is one, its in Help menu option

Author Closing Comment

ID: 31572864
After adding "localhost" as server in the createobject line it works fine
Thanks a lot!!
LVL 65

Expert Comment

ID: 24196697
Cool :) Glad your sorted now.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Take a look at these 6 Outlook Email management tools which can augment the working and performance of Microsoft Outlook to give you a more rewarding emailing experience.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question