• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

Display Notes Email from MS Access

Hi, I am trying to search for a particular Lotus Notes email using the UniversalID of that email and once found, open/display that email in Notes using code in MS Access VBA.  Is this possible?  I cannot use LotusScript.  Thanks, Hammer8
  • 2
  • 2
1 Solution

Here's a function that you can use...
Public Sub OpenMemoByUnid(ByVal unid As String)
  ' open current user's email file
  Dim sess As Object, email As Object, doc As Object
  Set sess = CreateObject("Notes.NotesSession")
  Set email = sess.GetDatabase("", "")
  ' get the document
  Set doc = email.GetDocumentByUNID(unid)
  If (doc Is Nothing) Then
    MsgBox ("Unable to locate the specified document!")
    Dim ws As Object
    Set ws = CreateObject("Notes.NotesUIWorkspace")
    Call ws.EditDocument(True, doc)
    Call AppActivate(ws.CurrentDocument.WindowTitle)
  End If
End Sub

Open in new window

Hammer8Author Commented:
Wow!  Great.  Is there a way to open the email, but not put it in Edit mode?  Thanks, Hammer8
Hammer8Author Commented:
I found it - chance true to false in EditDocument.  However, I sometimes get a run time error 5 on
Call AppActivate(ws.CurrentDocument.WindowTitle)

Appending " - IBM Lotus Notes" seems to help some, but still get the error?
I've never seen that function raise an error before.

You can either leave it out or tell VB to ignore the error by placing this line before the call to AppActivate.

    On Error Resume Next
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now