It appears that when I am running a VB6 script to pull addresses out of a notes Address Book, the notes.exe file leaks with every call to the notes.exe application.
Below is the VB6 code.
Private Sub UserForm_Initialize()
On Error GoTo erh:
Dim m_objNotesSession As Object ' Actually a NotesSession
Dim objDB As Object ' Actually a NotesDatabase
Dim objView1 As Object ' Actually a NotesView
Dim objView2 As Object ' Actually a NotesView
Dim objView3 As Object ' Actually a NotesView
Dim objDocs1 As Object ' Actually a NotesDocument
Dim objDocs2 As Object ' Actually a NotesDocument
Dim objDocs3 As Object ' Actually a NotesDocument
Dim strAccountID As String
Dim strName As String
On Error GoTo erh:
’ CurrentDocTextBox.Value = ActiveDocument.Name
'set module level variables
Set m_objNotesSession = CreateObject("Notes.Notessession")
m_strServer = ActiveDocument.CustomDocumentProperties("ARTIServer").Value
m_strARTIFilePath = ActiveDocument.CustomDocumentProperties("ARTI").Value
If m_objNotesSession Is Nothing Then
MsgBox "Failure to activate Notes session. " _
& m_cstrContactTechSupport, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End If
'get ARTI database
Set objDB = m_objNotesSession.GetDatabase(m_strServer, m_strARTIFilePath)
If objDB Is Nothing Then
If m_strServer = "" Then
m_strServer = "Local"
End If
MsgBox "There was an error locating the ARTI database " _
& m_strARTIFilePath & " on " & m_strServer _
& ". " & m_cstrContactTechSupport _
, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End If
' Getting the account the view
Set objView2 = objDB.GETVIEW(m_cstrViewByJobNum)
If objView2 Is Nothing Then
MsgBox "There was an error locating '" & m_cstrViewByJobNum _
& "' view in ARTI database " _
& m_strARTIFilePath & " on '" & m_strServer _
& "'. " & m_cstrContactTechSupport _
, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End If
' Getting the account the job document
Set objDocs1 = objView2.GetDocumentByKey( _
Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4))
If objDocs1 Is Nothing Then
MsgBox "There was an error locating job document " _
& "associated with open transcription in ARTI database " _
& m_strARTIFilePath & " on '" & m_strServer _
& "'. " & m_cstrContactTechSupport _
, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End If
' Getting the account ID
strAccountID = objDocs1.GetItemValue("AccountID")(0)
' Getting the Domino directory associated with this account
Set objView3 = objDB.GETVIEW(m_cstrViewAccount)
If objView3 Is Nothing Then
MsgBox "There was an error locating '" & m_cstrViewAccount _
& "' view in ARTI database " _
& m_strARTIFilePath & " on '" & m_strServer _
& "'. " & m_cstrContactTechSupport _
, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End If
Set objDocs2 = objView3.GetDocumentByKey(strAccountID & "^^^", True)
If objDocs2 Is Nothing Then
MsgBox "There was an error locating account '" & strAccountID _
& "' in ARTI database " & m_strARTIFilePath & " on '" & m_strServer _
& "'. " & m_cstrContactTechSupport _
, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End If
m_strDirectoryFilePath = Trim(objDocs2.GetItemValue("DirectoryFilePath")(0))
If m_strDirectoryFilePath = "" Then
MsgBox "There was an error locating" _
& " the Domino Directory associated with account '" _
& strAccountID & "'. " & Chr(13) _
& "Location is not set. " & m_cstrContactTechSupport _
, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End If
Set m_objAddressBook = m_objNotesSession.GetDatabase( _
m_strServer, m_strDirectoryFilePath)
If m_objAddressBook Is Nothing Then
MsgBox "There was an error locating" _
& " the Domino Directory associated with account '" _
& strAccountID & "'. " & m_cstrContactTechSupport _
, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End If
Set objView1 = m_objAddressBook.GETVIEW(m_cstrViewElysimUsers)
If objView1 Is Nothing Then
MsgBox "There was an error locating the '" _
& m_cstrViewElysimUsers & "' view in Domino Directory " _
& m_strDirectoryFilePath & " associated with account '" _
& strAccountID & "'. " & m_cstrContactTechSupport _
, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End If
Set objDocs3 = objView1.GetFirstDocument
While Not (objDocs3 Is Nothing)
strName = objDocs3.GetItemValue("LastName")(0) & ", " & _
objDocs3.GetItemValue("FirstName")(0)
If objDocs3.GetItemValue("MiddleInitial")(0) <> "" Then
strName = strName & " " & _
objDocs3.GetItemValue("MiddleInitial")(0)
End If
strName = strName & " (" & _
objDocs3.GetItemValue("ExtIDValues")(0) & ")"
AddressListBox.AddItem strName
Set objDocs3 = objView1.GetNextDocument(objDocs3)
Wend
Exit Sub
erh:
MsgBox "Error: " & Str(Err.Number) & ": " _
& Err.Description & " (" & Err.Source & "). " _
& m_cstrContactTechSupport, vbOKOnly, m_cstrErrorTitle
CCNames.Hide
End
End Sub