[Solved] VBA : Open Lotus Notes database from VBA

  • Hi all,


    I'd like to be able to open a lotus notes database from Excel VBA.


    I've looked at the code where you can open a Lotus notes mail session but how can I alter this code to open a specified lotus notes database (eg. not a lotusnotes mailbox).


    Any ideas much appreciated!

  • Villa,


    Did you get this one sorted?


    I'm having the same problem and was hoping we could exchange ideas.


    My code so far:


    Sub LotusNotes_CVXLib()
    Application.ScreenUpdating = False
    On Error GoTo error:
    Dim s As Object
    Dim db As Object
    Dim doc As Object
    On Error Resume Next
    AppActivate "Lotus Notes"
    If Not Err.Number = 0 Then
    Err.Clear
    MsgBox "Notes is Not Running", vbInformation, "WSM-Marketing"
    Else
    Set s = CreateObject("Notes.Notessession")
    ' Function GETDATABASE(SERVER As String, FILE As String, [CREATEONFAIL])
    Set db = s.GETDATABASE("WARRIOR1/AU/WAR/WERE", "WARRAU/Market/CVXLby.nsf")
    ' Call db.OPENMAIL
    Call db.???
    ' Set doc = db.CREATEDOCUMENT
    Set s = Nothing
    Set db = Nothing
    Set doc = Nothing
    End If
    Exit Sub
    error:
    End Sub


    I've been having trouble with Call db.??? as I can't figure what to put there?


    Regards


    AJW

  • Hi there,


    Unfortunately I never managed to acheive it.


    I'll have a look at your code and see if this can inspire me!


    Cheers,
    V

  • Villa + others,


    Figured it out, fairly simple once I stopped heading down one track and took another path. Must say that seem to be the way I've learnt most of my Excel VBA skills............ TRIAL & ERROR !


    So here's the cure.......


    I'm running Notes 6.5, by right mouse clicking on the toolbar area you get a list of available toobars (like with Excel).


    1. Select the one that says address.
    2. Open your database.
    3. Go to the address toolbar and click the dropdown, the address for your database will show in the toolbar.
    4. Copy the address.
    5. Paste the address in the following code, close your database (not Notes) and run the code.
    6. Hey presto up pops the database.
    7. Also works for Documents within a database.
    8. Enjoy !


    Sub LotusNotes_CVXDocLib()
    Application.ScreenUpdating = False
    On Error Resume Next
    AppActivate "Lotus Notes"
    If Not Err.Number = 0 Then
    Err.Clear
    MsgBox "Notes is Not Running", vbInformation, "WSM-Marketing"
    Else
    Application.ActiveWorkbook.FollowHyperlink Address:="Notes://WARRIORSYD1/4A2565BF00171D6E/8525608C005E322585255D7C00545AF7", NewWindow:=True
    End If
    Exit Sub
    End Sub


    Regards


    AJW

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!