Function ChkMailExt(maildbpath As String) As String ' checks incoming string for .nsf extension, if exists, returns same string, otherwise it appends it to the end Dim nsfpos As Integer ' position of .nsf in maildbpath On Error Goto FErrorHandler ' test for nothing If (maildbpath="") Then ChkMailExt = "" Exit Function End If nsfpos = Instr(1, maildbpath, ".nsf", 5) If Not (nsfpos>0) Then ' not found, add extension ChkMailExt = maildbpath & ".nsf" Else ' found, return as is ChkMailExt = maildbpath End If Exit Function FErrorHandler: ChkMailExt=maildbpath Exit Function End Function