Entering the Lotus Notes Password using VBA

mrholiday

Board Regular
Joined
Jan 27, 2006
Messages
57
Hello dear all,

I have an small issue with the Lotus Notes Password.
Problem is: Open Lotus Notes and entering the Notes User Password using VBA


After the code line:
Set session = CreateObject("Notes.NotesSession")

Lotus Notes opens and asks me for my Lotus Notes Access Password
I need to enter this manually in the Lotus Notes Password Window and only then the code continues running.

There is somehow a code line which should input the password automacitcally:

session.Initialize ("UserIdPassword")

but I do not manage to get it working.


Does somebody have an idea of how to write this code line correctly?


Best wishes from Luxemburg
and thanks in advance for any tip you may have
Jerry



Code:
Public Sub SendMail()
    
    
    Dim Subject As String
    Dim Maildb As Object
    Dim UserName As String
    Dim MailDbName As String
    Dim MailDoc As Object
    Dim session As Object
   
   
    Set session = CreateObject("Notes.NotesSession")
    session.Initialize ("UserIDPassword") '<<<< Here I have the problem
    'Run-time error '438'
    'Object doesn 't support this property or method
   

    UserName = session.UserName
    MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
    
    Set Maildb = session.GetDatabase("", MailDbName)
        If Maildb.IsOpen = True Then
     Else
         Maildb.OPENMAIL
     End If
     
    
    
    Set MailDoc = Maildb.CreateDocument
    MailDoc.Form = "Memo"
    MailDoc.sendto = "myemail@home.com"
    MailDoc.Subject = "Test Mail Sent"
    MailDoc.Body = "Body Text"
    MailDoc.SAVEMESSAGEONSEND = True
       
    MailDoc.PostedDate = Now()
    MailDoc.Send 0
      
   
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set session = Nothing
        
        
End Sub



Please see below an similar code where it works, but with this code the email sending is not working :(

Code:
Sub Test()

    Dim session As NotesSession
    Set session = CreateObject("Lotus.NotesSession") 'When I replace "Lotus" with "Notes" then it does not work
    session.Initialize ("UserIdPassword")
    
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top