Sub Initialize Dim s As New NotesSession Dim db As NotesDatabase Dim doc As NotesDocument Dim filename As String Dim Attachment As NotesRichTextItem Dim object As NotesEmbeddedObject Dim sizeInBytes As Long Dim d As String Dim compare As String Dim positionOfChar As Long Dim LowerLimit As Integer Dim UpperLimit As Integer Dim n As Integer Dim x As Integer Dim Numerics As Integer Set db = s.CurrentDatabase LowerLimit = 48 UpperLimit = 57 d = "c:\temp\gis\" ' source location of files to be attached to new docs filename = Dir$(d & "*.*") Do While filename$ <> "" ' set up new doc Set doc = db.CreateDocument doc.Form = "Document" Set Attachment = doc.CreateRichTextItem("Attachment") ' attach filename Set object = Attachment.EmbedObject(EMBED_ATTACHMENT, "", d & filename) doc.Filename = filename Call doc.Save(True, False) doc.FileSize = object.FileSize ' get position 4 character index number to create the index field for view categorization Numerics = 0 x = 0 n = 0 'x is just an integer pointer For x = 1 To Len(filename) n = Asc(Mid$(filename,x,1)) If n =>LowerLimit And n <= UpperLimit Then Numerics = Numerics + 1 If Numerics = 4 Then Goto FoundNum Else Numerics=0 End If Next x ' Since Numerics never made it to 4 set doc.Index to null & continue with save. docIndex="" ReturnedTrue: Call doc.Save(True, False) filename = Dir$() Loop Exit Sub FoundNum: doc.Index = Mid$(filename, x-3, 4) Goto ReturnedTrue End Sub