VBA to Lotus Notes Calendar entry issue

Posted on 2010-11-12
Last Modified: 2013-11-27

I found some code on EE that works great with one small exception. Each time I click the button to add the calendar entry it prompts me for my email password. Is there any way to code that in?  Here is the code I found:

Const Subject = "September staff meeting (Tuesday the ninth)"

    Const position = "9/9/2009 10:00 AM"

    Dim s As New NotesSession


    Dim dir As NotesDbDirectory

    Dim db As NotesDatabase

    Set dir = s.GetDbDirectory("")

    Set db = dir.OpenMailDatabase

    MsgBox db.Title & " on " & db.Server, , db.FilePath

    Dim doc As Object 'notesDocument

    Set doc = db.createDocument

    doc.replaceItemvalue "Form", "Appointment"

    Dim dateTime As Object 'NotesDateTime

    Set dateTime = s.createDateTime(position)

    doc.replaceItemvalue "$Alarm", 1

    doc.replaceItemvalue "$AlarmOffset", 0

    MsgBox "Setting reminder/alarm - " & dateTime.lslocalTime & " - " & Subject

    doc.replaceItemvalue "startDateTime", dateTime

    doc.replaceItemvalue "endDateTime", dateTime

    doc.replaceItemvalue "calendarDateTime", dateTime

    doc.replaceItemvalue "Subject", Subject

    doc.replaceItemvalue "startTime", dateTime

    doc.replaceItemvalue "appointmentType", "3"

    doc.replaceItemvalue "Alarms", "1"

    doc.replaceItemvalue "startDate", dateTime

    doc.replaceItemvalue "endDate", dateTime

    doc.replaceItemvalue "endTime", dateTime

    doc.Save True, True

    doc.putInFolder "($Alarms)"

Open in new window

Thanks for any help you can give me.
Question by:G Scott
  • 3
  • 2
LVL 46

Accepted Solution

Sjef Bosman earned 125 total points
Comment Utility
AFAIK, two ways:
- you modify the Initialize to include your password
- you leave it as it is, and you select "Don't prompt for a password from other Notes-based programs" in the Notes security settings.

I hope I'm not too late... ;-)

Author Comment

by:G Scott
Comment Utility
sjef bosman, nope you are not too late, in fact, I was hoping to hear from you since you may recognize the code. ;)  

How exacly do you modify the Initialize to include the password??  Sorry, kinda new to VBA.
LVL 22

Assisted Solution

mbonaci earned 125 total points
Comment Utility
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.


Author Closing Comment

by:G Scott
Comment Utility
Thanks! That worked great!!

Author Comment

by:G Scott
Comment Utility
One interesting thing about that code maybe someone can help. When I click on it on my calendar it says "Error trying to open document: Note item not found" AND it does't get replicated. Any thoughts?
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
About the error: no clue at all... You could try to run the debugger to find out where the error comes from.

The document isn't replicated? There isn't a replication formula present for the database? No Readers fields in the document? Then it *should* replicate...

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos ( and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now