Ask the Expert

Automatically attach 700 documents in database

I have a domino database in which all docs will be deleted. I need to create new docs and on each document attach either a word or excel document. There are a total of 700 word/excel docs that will have to be attached, therefore 700 notes documents that will have to be created. How can I automatically do this?

This code is NOT complete... It is mostly functional, but it is meant to demonstrate how you could complete the task you are attempting. You will have to fill in some blanks yourself.

First, use the method in the following example to build an array of filenames for your program...

Dim pathName1, pathName2, fileName1, fileName2 As String
PathName1 = "c:\*.xls"
FileName1 = Dir$(pathName1, 0)
PathName2 = "c:\*.doc"
FileName2 = Dir$(pathName2, 0)
Dim counter as integer
Do While fileName1 <> ""
   Redim preserve fileList1(counter)
   FileList1(counter) = FileName1
   FileName1 = Dir$()
'Repeat for FileName2...
   Counter = counter + 1

Dim thisNotesDB as NotesDatabase 'Set it with NotesSession, etc...

For k = 0 to ubound(FileName1)
Dim newDoc as New NotesDocument(thisNotesDB)
Dim object as NotesEmbeddedObject
Dim item as NotesRichTextItem
Set item = new NotesRichTextItem( newDoc, "body" )
Set object = item.EmbedObject( EMBED_ATTACHMENT, "", filename1(k))
Call false, false )
Next k

This was first published in December 2001

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: