dsacker
asked on
ActiveX Component Can't Create Object
Because of a corporate buyout, our desktops have recently been "re-imaged". Now I cannot send email via my VB/VBA code. The following technique used to work well:
Set Session = CreateObject("Notes.NotesS ession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set MailDb = Session.GETDATABASE("", MailDbName)
If MailDb.ISOPEN = False Then
MailDb.OPENMAIL
End If
...
However, the "Set Session" line now returns an "ActiveX Component Can't Create Object" error. I've attempted the following solutions to no avail:
* I registered (regsvr32) C:\lotus\notes\nlsxbe.dll ... still cannot CreateObject("Notes.NotesS ession")
* I changed the code to CreateObject("Lotus.NotesS ession"), instead of "Notes.NotesSession" ... this created a world of headaches (i.e., password prompting, MailDoc.Form/Subject/etc properties not available)
If there is/are some other DLL(s) to register, some switches in Lotus Notes to set, I'm definitely open for suggestions. My goal is simply to automatically email an Excel spreadsheet out to a list of recipients, streamlessly ... as before.
Thanks.
Set Session = CreateObject("Notes.NotesS
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set MailDb = Session.GETDATABASE("", MailDbName)
If MailDb.ISOPEN = False Then
MailDb.OPENMAIL
End If
...
However, the "Set Session" line now returns an "ActiveX Component Can't Create Object" error. I've attempted the following solutions to no avail:
* I registered (regsvr32) C:\lotus\notes\nlsxbe.dll ... still cannot CreateObject("Notes.NotesS
* I changed the code to CreateObject("Lotus.NotesS
If there is/are some other DLL(s) to register, some switches in Lotus Notes to set, I'm definitely open for suggestions. My goal is simply to automatically email an Excel spreadsheet out to a list of recipients, streamlessly ... as before.
Thanks.
I would re-install Notes using a standard install, instead of the image. Winstall has ben known to do a real number on Notes installations.
ASKER
Can't ... I have two desktop machines, both "re-imaged". Notes was installed on both of them after the re-imaging, via "approved" protocols. In other words, I'm stuck having to get this to work in my existing environment.
If I go the "Lotus.NotesSession" approach, there are numerous headaches, but it looks like after a lengthy time I might be able to peril them all. I'm simply hoping for some "rabbit in the hat" (lol).
Thanks.
If I go the "Lotus.NotesSession" approach, there are numerous headaches, but it looks like after a lengthy time I might be able to peril them all. I'm simply hoping for some "rabbit in the hat" (lol).
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Let's not forget, if it doesn't work, the image is wrong. Your desktop engineering guys gotta support that!
I would be interested in knowing how you finally resolve the problem.
I would be interested in knowing how you finally resolve the problem.
Oh, and by the way, the following is a really bad practice:
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Probably makes no difference as you are doing this in a fairly closed environment, but there is no guarantee that a mail file name matches finitial + lname. The proper way is as follows:
Set MailDB = session.getDatabase( "", "" )
MailDB.OpenMail
Which is actually two lines instead of three :)
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Probably makes no difference as you are doing this in a fairly closed environment, but there is no guarantee that a mail file name matches finitial + lname. The proper way is as follows:
Set MailDB = session.getDatabase( "", "" )
MailDB.OpenMail
Which is actually two lines instead of three :)
ASKER
My key info is as follows:
[HKEY_LOCAL_MACHINE\SOFTWA RE\CLASSES \CLSID\]
{29131539-2EED-1069-BF5D-0 0DD011186B 7} = "Lotus Domino Session"
...\InprocServer32
Default = C:\Lotus\Notes\nlsxbe.dll
ThreadingModel = Both
...\ProgID
Default = Lotus.NotesSession.1
...\TypeLib
Default = {29131520-2EED-1069-BF5D-0 0DD011186B 7}
...\VersionIndependentProg ID
Default = Lotus.NotesSession
I have no keys that contain the values "Notes.NotesSession" or "notes.exe /Automation". Hmmmm.
I've come to understand the enclosed-ness of coding MailDbName = Left$ .... it was taken from here on experts-exchange and (luckily) worked at the time. I wouldn't yet know if Session.GetDatabase("","") will work until I can get this damn Notes.NotesSession resolved (lol).
Your help is very much appreciated.
[HKEY_LOCAL_MACHINE\SOFTWA
{29131539-2EED-1069-BF5D-0
...\InprocServer32
Default = C:\Lotus\Notes\nlsxbe.dll
ThreadingModel = Both
...\ProgID
Default = Lotus.NotesSession.1
...\TypeLib
Default = {29131520-2EED-1069-BF5D-0
...\VersionIndependentProg
Default = Lotus.NotesSession
I have no keys that contain the values "Notes.NotesSession" or "notes.exe /Automation". Hmmmm.
I've come to understand the enclosed-ness of coding MailDbName = Left$ .... it was taken from here on experts-exchange and (luckily) worked at the time. I wouldn't yet know if Session.GetDatabase("","")
Your help is very much appreciated.
You definitely need the [HKEY_LOCAL_MACHINE\SOFTWA RE\CLASSES \CLSID\{29 131401-2EE D-1069-BF5 D-00DD0111 86B7}] key.
I forgot to give you the reg file for [HKEY_CLASSES_ROOT\Notes.N otesSessio n] -- that one will obviously be just as key as the 401:
REGEDIT4
[HKEY_CLASSES_ROOT\Notes.N otesSessio n]
@="Notes R4.0 NotesSession"
[HKEY_CLASSES_ROOT\Notes.N otesSessio n\Clsid]
@="{29131401-2EED-1069-BF5 D-00DD0111 86B7}"
REGEDIT4
[HKEY_CLASSES_ROOT\Notes.N
@="Notes R4.0 NotesSession"
[HKEY_CLASSES_ROOT\Notes.N
@="{29131401-2EED-1069-BF5
ASKER
Thanks for all your help ... I know it wasn't beaucoup points, but it is very much appreciated.
I've finally gotten the code to work ... here's what I'm now using in place of the former Notes.NotesSession approach:
Private Sub SendNotesEmail(Subject As String, _
ByVal Attachment As String, _
Recipient As String, _
BodyText As String, _
SaveIt As Boolean)
Dim AttachME As Object 'The attachment richtextfile object
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim MailDb As Object 'The mail database
Dim MailDbName As String 'The current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim MailFile As String 'The mail ename
Dim Session As Object 'The notes session
Dim MailList() As String 'Multiple recipients
Set Session = CreateObject("Lotus.NotesS ession")
Session.Initialize
Set MailDb = Session.GetDbDirectory("") .OpenMailD atabase
If MailDb.IsOpen = False Then
MailDb.Open
End If
Set MailDoc = MailDb.CreateDocument
MailDoc.AppendItemValue "Form", "Memo"
MailDoc.AppendItemValue "Subject", Subject
MailDoc.AppendItemValue "Body", File_Contents(BodyText)
MailDoc.AppendItemValue "PostedDate", Now()
MailDoc.AppendItemValue "SendTo", MailList
MailDoc.SaveMessageOnSend = SaveIt
Set AttachME = MailDoc.CREATERICHTEXTITEM ("Attachme nt")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
MailDoc.Send True
Set EmbedObj = Nothing
Set AttachME = Nothing
Set MailDoc = Nothing
Set MailDb = Nothing
Set Session = Nothing
End Sub
I had to go into my Lotus Notes settings, i.e., Files, Tools, User ID ... and then turn on the checkbox "Don't prompt for a password from other Notes-based programs", in order to get it to run streamlessly. Hope this benefits others.
Again, thanks.
I've finally gotten the code to work ... here's what I'm now using in place of the former Notes.NotesSession approach:
Private Sub SendNotesEmail(Subject As String, _
ByVal Attachment As String, _
Recipient As String, _
BodyText As String, _
SaveIt As Boolean)
Dim AttachME As Object 'The attachment richtextfile object
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim MailDb As Object 'The mail database
Dim MailDbName As String 'The current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim MailFile As String 'The mail ename
Dim Session As Object 'The notes session
Dim MailList() As String 'Multiple recipients
Set Session = CreateObject("Lotus.NotesS
Session.Initialize
Set MailDb = Session.GetDbDirectory("")
If MailDb.IsOpen = False Then
MailDb.Open
End If
Set MailDoc = MailDb.CreateDocument
MailDoc.AppendItemValue "Form", "Memo"
MailDoc.AppendItemValue "Subject", Subject
MailDoc.AppendItemValue "Body", File_Contents(BodyText)
MailDoc.AppendItemValue "PostedDate", Now()
MailDoc.AppendItemValue "SendTo", MailList
MailDoc.SaveMessageOnSend = SaveIt
Set AttachME = MailDoc.CREATERICHTEXTITEM
Set EmbedObj = AttachME.EMBEDOBJECT(1454,
MailDoc.Send True
Set EmbedObj = Nothing
Set AttachME = Nothing
Set MailDoc = Nothing
Set MailDb = Nothing
Set Session = Nothing
End Sub
I had to go into my Lotus Notes settings, i.e., Files, Tools, User ID ... and then turn on the checkbox "Don't prompt for a password from other Notes-based programs", in order to get it to run streamlessly. Hope this benefits others.
Again, thanks.
Notes.NotesSession ("COM") is still the better way to go. You never got that working again :( ?
Gwaletee.
I use to have my Lotus working using the CreateObject("Notes.NotesS ession") with no problems.
Now I've moved and the image has changed, etc...
I get the ActiveX 429 error at this line.
Regsvr32 didn't help though it did register successfully.
I went into the registry and didn't find ANY 401 entries.
So I figure I would go ahead and create them.
No luck.
My problem still exist at the same point.
I do have a question about the localserver and localserver32 settings you gave.
Can I find those settings on my own since they are not already in the registry without having to go through admin?
The notes.exe I see is local and putting that in those places doesn't help either.
I can work around it using dsaker's method, but I really would like to get this one back up and running. For now I'm using his method, but your help would be welcome.
I mean this will do because I can continue to automate some mail.
I have to read back and see where people answered my call about automating reading mail in the same process to help dictate outgoing mail.
XP PRO / Lotus R5
Thanks!
I use to have my Lotus working using the CreateObject("Notes.NotesS
Now I've moved and the image has changed, etc...
I get the ActiveX 429 error at this line.
Regsvr32 didn't help though it did register successfully.
I went into the registry and didn't find ANY 401 entries.
So I figure I would go ahead and create them.
No luck.
My problem still exist at the same point.
I do have a question about the localserver and localserver32 settings you gave.
Can I find those settings on my own since they are not already in the registry without having to go through admin?
The notes.exe I see is local and putting that in those places doesn't help either.
I can work around it using dsaker's method, but I really would like to get this one back up and running. For now I'm using his method, but your help would be welcome.
I mean this will do because I can continue to automate some mail.
I have to read back and see where people answered my call about automating reading mail in the same process to help dictate outgoing mail.
XP PRO / Lotus R5
Thanks!
No piggybacking. Ask your own question.
I have tried something else, whenever i create lotusnotes mail DB path in the same PC where the program is, it works fine, but when i give it the server path or other PC path it gave me the same error!
Can you guide me how can connect it to the server may b i did something wrong in my code!
Can you guide me how can connect it to the server may b i did something wrong in my code!