How to grab mailfile name from location doc

Does anyone have a clue why I continue to get “Object Variable not set”?

I think the problem is the location name. It runs to the last line and throws up the error. I’m out of ideas.

Thank you

Mike

 'Picks up Local Address Book and mailfile name

Set db2 = New NotesDatabase("", "names.nsf")

Dim LocName As Variant

Dim mailfile As String

Dim doc2 As NotesDocument

            Dim itm As NotesItem

Dim collection As NotesDocumentCollection

 'finds "Office(Network)" Location Document

Set collection = db2.FTSearch( """Office""", 0, FT_SCORES, FT_STEMS)

Set doc2 = collection.getfirstdocument

 'Finds the mail file and sets the variable

Set itm = doc2.GetFirstItem("MailFile")

mailfile = itm.text & ".nsf"

Subject: How to grab mailfile name from location doc.

This just gets better and better.

For some users it works and others it does not.

It has to be something in the location document. All users are running the same ver of the notes client.

Subject: RE: How to grab mailfile name from location doc.

Try this:

mail_server$=session.GetEnvironmentString (“MailServer”, True) 'Get user’s home/mail server

mail_file$=session.GetEnvironmentString (“MailFile”, True) 'Get user’s mail file name