Open document in Notes app from VBA

Discussion in 'Lotus Notes Programming' started by Tom Koester, Aug 9, 2005.

  1. Tom Koester

    Tom Koester Guest

    Hi folks,

    Here my problem:
    I want to open a Notes document via VBA(MS ACCESS 2000) within the
    Notes application. When done the Notes app shall receive the focus so
    that the user can review the document. This shall also work if Notes is
    already running in the background. Getting the UID of the doc is not
    the problem.

    Here what I already tried/checked
    1) The command line option Notes://server/... fails if Notes is already
    running
    2) NotesUIWorkspace.EditDocument is not supported in COM

    Here my best idea (maybe you have better ones)
    A LotusScript program within the DB could open the document with
    NotesUIWorkspace.EditDocument but how do I pass the argument (e.g. UID)
    from ACCESS to Notes and how do I push Notes to the front afterwards?

    A head scratching
    Tom Koester
     
    Tom Koester, Aug 9, 2005
    #1
    1. Advertisements

  2. Tom Koester

    Tom Koester Guest

    I found the solution myself. The key is to use OLE instead of COM. OLE
    allows to use the UI classes of Notes. Here the code snippet:

    -----------------
    Dim lnUIWorkspace As Object

    '--- establish OLE connection with CreateObject("Notes.xxx")
    Set lnUIWorkspace = CreateObject("Notes.NotesUIWorkspace")

    '--- locate doc in view via document key (just one option)
    lnUIWorkspace.OpenDatabase csSERVER, csDB, csVIEW, csKey
    '--- open doc in read mode
    lnUIWorkspace.EditDocument False

    Set lnUIWorkspace = Nothing
     
    Tom Koester, Aug 10, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.