|
Your problem lies in you mixing background and foreground methods.
CopyItem is a LotusScript method for copying an item of the type NotesItem. A NotesItem is only available on a background document.
So your Call docT.CopyItem( tattach, "attach" ) is OK except for the bit where it says tattach. Tattach is not a reference to a NotesItem, it is a field on the foreground document -- the UIdoc.
What you need to do is something like this:
Call uidoc.Save
Dim backDoc As Notesdocument
Set backDoc = uidoc.Document
Dim tattachItem As NotesItem
Set tattachItem = backDoc.
GetFirstItem("tattach")
Call docT.CopyItem(tattachItem, "attach" )
I believe that this would do the trick.
Do you have comments on this Ask the Expert Q&A? Let us know.
|