Lotus Notes
I am using the following code to test for the existence of a notes session
and if not then to start it:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub CheckNotes()
Dim hwnd As Long
program = "Notes"
hwnd = FindWindow(program, vbNullString)
If hwnd < 0 Then
MsgBox "Notes is already running"
Else
MsgBox "Notes will now start"
ShellExecute 0, "open", "C:\Documents and Settings\All Users\Desktop\lotus
notes.lnk", "", "c:\", 1
End If
Application.Visible = True
End Sub
Problem is I need to shift focus back to excel after the password has been
entered into the new notes session but I am failing miserably.
Grateful for any ideas.
|