LDD Today

Tips from LDD

Copying and pasting documents as response documents


Tip submitted by
Lynne Johnson

Level: Intermediate
Works with: Notes/Domino
Updated: 01-Jul-2003

Have you ever needed to copy and paste a document from one database to another and to make the copied document a response to a parent document? For instance, suppose you emailed a colleague a topic from a discussion database and rather than replying to you in the discussion database, your colleague sent you an email reply. Using the agent code below, you can copy the document from your Inbox to the discussion database and create a response document to the original topic.

Note: You must include the form of the copied document in the database in which you want to paste the document.

This tip may be particularly useful in a tracking database in which you want to save relevant information like emails. Create an agent in the database to which you want to copy documents. In the Agent Properties box, select the When documents are pasted option in the Runtime drop-down, then add the following code to the agent:

Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim Pasteddoc As NotesDocument
Dim j As Integer

Set db = session.CurrentDatabase
'Set currently highlighted doc
Set doc = session.documentcontext

'Find documents to paste- if there are none then stop process
Set dc = db.UnprocessedDocuments
If DC.count <1 Then End If

For i = 1 To dc.count 'Make new pasted doc a response to the selected doc Next
Exit Sub

Now, you can copy a document from a database, select a parent document in the database you want to copy the document to, then paste the document into the database.


SUBMIT YOUR TIPS!
We encourage you to send us your tips (You can also click the "Would you like to submit a tip?" graphic below.) Your tips can be anything you've discovered about any Lotus product. The most important thing is that your tip be interesting, useful, or handy. And be sure to include complete information about how your tip works. For ideas, take a look at our tip archives. If we publish your tip, we'll send you the IBM Redbooks Lotus Collection on CD.