IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Technical Library
developerWorks



Tips from LDD

Copying and pasting documents as response documents


Tip submitted by
Lynne Johnson


Level: Intermediate
Works with: Notes/Domino
Updated: 07/01/2003

Related link:
More Tips from LDD


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
    Messagebox("No document has been selected - try again")
    Exit Sub
End If

For i = 1 To dc.count
    Set pasteddoc = dc.GetNthDocument( i)
'Make new pasted doc a response to the selected doc
    Call Pasteddoc.MakeResponse( doc )
    Call pasteddoc.save(True,True)
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.






Would you like to submit a tip?
    About IBM Privacy Contact