views:

44

answers:

1

My Excel application sends email updates using Lotus Notes and I am having trouble finding a quick and reliable way of ensuring that that the user is logged in to Notes.

If the user is not logged into Notes before they perform an operation that calls Notes then the code stalls on Set NotesDocument = NotesMailFile.CreateDocument as Excel waits for the user to log in to Notes.

Unfortunately, Notes can sometimes start 'under' Excel and all the user sees is an egg timer cursor, leaving them to think that the emailing is just taking a bit of time. Some part of the operation times out after 20 seconds or so and this generates an error in Excel. While I can handle this as a kludgey way of determining if Notes is running, it does take some time.

I thought of using AppActivate ("Notes") but while this confirms the application is running, it still returns true even if there is no-one logged in.

What I was really hoping for is testing for the availability of some Domino object that will only be available if the user is logged in, but that won't trigger the Notes log in dialog, so I can test before even trying the email code.

A: 

Maybe something like this will work?

Dim session As New NotesSession
Dim username As String
username = session.EffectiveUserName
bugtussle