Hi all,
I need to open open 2 docs in the ui via LS, one after another, but the 2nd will not open visibly.
the script goes like:
============================================
… got templatedoc somehow …
then:
'create my first uidoc (from that already stored templatedoc)
Set uidoc = ws.EditDocument(True,templatedoc)
Call uidoc.GotoField( “TPL_Body” )
Call uidoc.SelectAll
Call uidoc.Copy
Call uidoc.Close(True)
'The following is just to be sure that closing the 1st is finished before I open the 2nd (without this the effect is the same …)
While Not uidoc Is Nothing
Sleep 1
Wend
sleep 1
'––– now create a new Memo ––––
Set doc = db.CreateDocument
doc.Form = “Memo”
Set source = ws.EditDocument(True,doc)
Set doc = source.Document
If source.CurrentField <> “Body” Then
Call source.GotoField(“Body”)
End If
Print source.CurrentField '-- Prints “Body”
'… do sth. … in my case:
Call source.Paste
'but even with no code there the new doc will not appear in the UI.
===========================================
thanks for any help
Uwe
PS:
if I run the agent in debug mode, it works (most of the time, not always …)
And if I place the line:
Call uidoc.Close(True)
to the end, after opening the 2nd uidocument, it works … but I am not happy with that - not sure if it doesn’t just work by accident.