Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Office 2013, GetObject does not work for Outlook

398 views
Skip to first unread message

Branislav Mihaljev

unread,
Jun 28, 2016, 1:54:47 AM6/28/16
to
On Office 2013 and Windows 8 and the other PC Windows 10, this:

Dim objOutlook As Object
Set objOutlook = GetObject(, "Outlook.Application")

should work when Outlook is open, but it does not, it gives error 429 like when Outlook is closed.

When Outlook is closed I can run it and create email, that is not an issue:

Dim objOutlook As Object
Set objOutlook = CreateObject(, "Outlook.Application")
'send email

Why GetObject does not work?

Branislav Mihaljev

unread,
Jun 28, 2016, 2:31:34 AM6/28/16
to
I am onto something. I have 2 versions of Office installed, 2003 and 2013, but, of course, only one Outlook. I think this is causing GetObject to fail in late binding. Thus, this does not work either:

Dim objOutlook As Object
Set objOutlook = GetObject(, "Outlook.Application.15")

but when I use early binding with reference to "Microsoft Outlook Object Library 15.0", it work:

Dim objOutlook As Outlook.Application
Set objOutlook = GetObject(, "Outlook.Application")

Since the client have PC's with mixed 2013 and 2016, obviously I cannot use early binding.

Ron Paii

unread,
Jun 28, 2016, 8:28:47 AM6/28/16
to
From help

If pathname is a zero-length string (""), GetObject returns a new object instance of the specified type. If the pathname argument is omitted, GetObject returns a currently active object of the specified type. If no object of the specified type exists, an error occurs.

The returned error = 429. I trap this error and resume to a line that uses "CreateObject"

ex.

Set oApplication = GetObject(, "Outlook.Application")
OpenOutlook: ' Resume from error because Outlook was NOT open
If oApplication Is Nothing Then
Set oApplication = CreateObject("Outlook.Application")
End If



Ulrich Möller

unread,
Jun 28, 2016, 10:00:49 AM6/28/16
to
Hi Ron,

the help also mention the behavior for single registered objects. This
is true for the outlook application so with

set oApplication = GetObject(vbNullstring, "OutlookApplication")

you will get a reference to the current outlook instance or a new
instance if it is not already running. No need to use "CreateObject" at
all.

Ulrich




Ron Paii

unread,
Jun 28, 2016, 10:51:57 AM6/28/16
to
The OP used

GetObject(, "Outlook.Application")

which will generate an error if Outlook is not open

not

GetObject("", "Outlook.Application")

Branislav Mihaljev

unread,
Jun 28, 2016, 1:58:47 PM6/28/16
to
Yes, my mistake typing, but GetObject does not work on a computer with multiply Office installed. That is what I strongly believe it does not work.

Ron Paii

unread,
Jun 29, 2016, 7:59:32 AM6/29/16
to
Unless you have multiple version of Outlook installed, It should work.

I have workstations with the following combinations.
Office 2007, Access runtime 2010
Office 2010, Access runtime 2016
Office 2013, Access runtime 2010
Office 2014, Access runtime 2016
In all cases GetObject(, "Outlook.Application") works.

Branislav Mihaljev

unread,
Jul 21, 2016, 2:06:52 AM7/21/16
to
Thanks.

As far as I know there cannot be multiple versions of Outlook on a single computer, unlike other Office programs.

I can confirm that on all my computers with Office 2003/2013 GetObject for Outloook IS NOT working. On all computers with single version of Office, it works.
0 new messages