Send Mail using VB script (saleslogix) to R7

Hi,

I have a problem in the ‘Create Object’… We have just migrated to R7 from Version 5. In the previous version the below code was working fine…but after our mail server upgrade the saleslogix application started giving the below error:-

‘ActiveX component can’t create object: Notes.NotesSession’ at line 226, char 5’.

Any help in the below code is much appriciated.

Sub SendNotesMail(Subject, Recipient, BodyText, SaveIt)

'Set up the objects required for Automation into lotus notes

Dim Maildb 'The mail database

Dim UserName 'The current users notes name

Dim MailDbName 'THe current users notes mail database name

Dim MailDoc 'The mail document itself

Dim AttachME 'The attachment richtextfile object

Dim Session 'The notes session

Dim EmbedObj 'The embedded object (Attachment)

'Start a session to notes

Set Session = CreateObject("Notes.NotesSession")



'Next line only works with 5.x and above. Replace password with your password

'Session.Initialize ("password")

'Get the sessions username and then calculate the mail file name

'You may or may not need this as for MailDBname with some systems you

'can pass an empty string or using above password you can use other mailboxes.

UserName = Session.UserName

MailDbName = Left(UserName, 1) & Right(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"

'Open the mail database in notes

Set Maildb = Session.GETDATABASE("", MailDbName)



If Maildb.ISOPEN = True Then

      'Already open for mail

 Else

     Maildb.OPENMAIL

 End If

'Set up the new mail document

Set MailDoc = Maildb.CREATEDOCUMENT

MailDoc.Form = "Memo"

MailDoc.sendto = Recipient

MailDoc.Subject = Subject

MailDoc.Body = BodyText

MailDoc.SAVEMESSAGEONSEND = SaveIt



'Send the document

MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder

MailDoc.SEND 0, Recipient

'Clean Up

Set Maildb = Nothing

Set MailDoc = Nothing

Set AttachME = Nothing

Set Session = Nothing

Set EmbedObj = Nothing

End Sub

Thanks

Naveen

Subject: Send Mail using VB script (saleslogix) to R7

Do you know which is line 226?If not, try adding extra line(s) at different spots and watch the error message to see if the line# goes up/down.

You can more easily troubleshoot when you know which object raised the exception.

It might be a problem opening the mailbox, or creating the form, or the SendTo (is that notes name or internet addr?)

If this is triggered while notes client is running, do you have the security setting checked which allows other applications to share in login?

Subject: Send Mail using VB script (saleslogix) to R7

Hi Naveen,

the error message points to the line:

Set Session = CreateObject(“Notes.NotesSession”)

Im sorry, by now we dont have Notes 7 here. But i can give you the tip, that you could take a look at your registry. In order to use “Notes.NotesSession” you need to have a key in

HKEY_CLASSES_ROOT which is names Notes.NotesSession :wink:

If you dont have it, maybe you didnt install Notes and reinstalling it could solve the problem. I am having a similiar problem which solution could help you as soon as someone gives me an answer.

You can take a look at it here:

http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllThreadedweb/202badf8fdced6b18525727c00460b44?OpenDocument

Regards,

Sven