Error 429 when calling CreateObject("Lotus.NotesSession") from Word VBA script

1.8k views Asked by At

Trying to build a rather simple VBA script in Word 2013 accessing data from a specific Domino database. My script is working fine if I resort to old-school OLE Automation (see 2nd snippet), but not if using specific Domino COM objects using early binding which I would highly prefer.

I made sure that both Word 2013 and Notes 9.0.1 FP9 are properly installed on my Windows 7 (x64) machine. Inside Word's VBA editor I made sure the reference to "Lotus Domino Objects" (domobj.tlb) is enabled.

I'm aware that there are various versions of creating a NotesSession object and I guess I tested them all. Here's one example for 'early binding' code:

Sub controlNotesCOM()
    Dim sn As NotesSession
    Dim db As NotesDatabase

    Set sn = CreateObject("Lotus.NotesSession")
    Call sn.Initialize

    MsgBox sn.COMMONUSERNAME, , "UserName"
    Set db = sn.GETDATABASE("", "mail\mymail.nsf")
    If (db.IsOpen()) Then
        MsgBox db.Size, , "Size"
    Else
        MsgBox "DB not open", , "ERROR"
    End If
End Sub

Running this snippet in debug mode I receive runtime error 429 'Active X Component Can't create the object' at line #3:

Set sn = CreateObject("Lotus.NotesSession")

I know that I had similar codes running in the past, but that was with earlier versions of Notes and Word (don't recall which versions).

The following old-school method using OLE Automation however is still working, so I don't think that this is a registry problem:

Sub controlNotesOLE()
    Dim sn As Object
    Dim db As Object

    Set sn = CreateObject("Notes.NOTESSESSION")
    'Call sn.Initialize

    MsgBox sn.COMMONUSERNAME, , "UserName"
    Set db = sn.GETDATABASE("", "mail\lmueller.nsf")
    If (db.IsOpen()) Then
        MsgBox db.Size, , "Size"
    Else
        MsgBox "DB not open", , "ERROR"
    End If
End Sub

Is anyone having an idea what could be going wrong here? Is this probably a combination that cannot work, for whatever reason?

1

There are 1 answers

1
Lothar Mueller On BEST ANSWER

Oh dear, I think I've got it: Runtime error 429 in VBA, but class is registered

Notes Client (still) is 32bit, and indeed I installed the 64bit Version of Office 2013. So that makes sense.

(hint: the linked post has some tips on how to work around this; not really suitable in my current project but maybe for others)