We have a kind functionality to insert richtext coming from a document into another open document.It works for years… till we change to 8.5
Main line of the button
=======================
-
within an edited document, we place the cursor into a richtext Body
-
the button “Insert text” show a view to choose the target document we the the text to be insert into
-
the button open the choosen document, select all the text, copy it into clipboard, close the document
-
then we insert it into the field of the actual document
this work without problems for years.
we need it in LotusScript because we have some added features in the button.
Code of the button
==================
Sub Click(Source As Button)
Dim doc As NotesDocument, uid As NotesUIDocument, db As NotesDatabase
Dim uiw As New NotesUIWorkspace
Set uid = uiw.CurrentDocument
Set db = uid.Document.ParentDatabase
Set doc = uiw.PickListCollection( PICKLIST_CUSTOM, False, db.Server, db.FilePath, "(Textes)", "Selecting a document", "Choose the good line and click OK !").GetFirstDocument
If Not doc Is Nothing Then
Call uiw.EditDocument (False, doc)
With uiw.CurrentDocument
.SelectAll
.Copy
.Close True
End With
uid.Paste
End If
End Sub
“(Textes)” is the name of the wiew we choose the target document
Problem
=======
after copying the texte, the paste get “Document command is not available”.
If I pursue immediately with “Edit \ Paste” manually it works
The same code does work correctly on Lotus 5, 6, 7.
Tries
=====
- If I add :
uid.InsertText “xxx”
just before the Paste, the insertion does work, but I get the same message on the uid.Paste.
- If I add :
Print uid.Document.UniversalID(0) before
I can see I’m on the right document.
Thanks for help
Pierre Frappé
Subject: More info
Before the paste, I just put
Print thisuid.Document.UniversalID
If uiw.CurrentDocument Is Nothing Then
Print "nothing"
Else
Print "something"
End If
In version 7, I get “something”
In version 8.5 “nothing”
However, “thisuid” contains something.
I think this is a bug and probably version 8.5 loose the focus on the first document as we go back.
Subject: Another simpler way to reproduce the problem (notesuidocument.Paste)
-
Put this button (action) on a response form containing a rich text item (see code below)
-
Create a parent document
-
Create a response document and save it
-
Reopen this response document in edit mode
-
put your cursor une rich text field
-
click on button : it should open the parent document, copy and close it, and paste in the richtextfield.
It works in Lotus 5,6,7 but not in 8.5.
Sub Click(Source As Button)
Dim thisuid As NotesUIDocument
Dim thisdoc As NotesDocument
Dim parentuid As NotesUIDocument
Dim parentdoc As NotesDocument
Dim uiw As New NotesUIWorkspace
'getting this document
Set thisuid = uiw.CurrentDocument
Set thisdoc = thisuid.Document
'getting parent document
Set parentdoc = thisdoc.ParentDatabase.GetDocumentByUNID(thisdoc.ParentDocumentUNID)
'opening the parent document
Set parentuid = uiw.EditDocument (False, parentdoc)
Print parentuid.Document.UniversalID
'copying all text and closing UI of parent document
parentuid.SelectAll
parentuid.Copy
parentuid.Close True
'now we are back on "thisuid'
'and inserting text will prove it
thisuid.InsertText "I'm here"
'== BUT THIS ONE DOESN'T WORK ON 8.5
thisuid.Paste
' Document command is not available
End Sub
Subject: Any resolution for WEBB7SVGHF
Greetings,
I was so happy to see your posting as we are having the identical problem with an application. Has there been any resolution to this?
Thank you.