I’m getting a handle on an embedded word object in a back-end document and using the Activate method to open it in Word (2002). I’m using Show = True.
Word opens and stays open, but the Word doc that I activated shows for only a split second, then disappears, after which Word just has a document-less interface. No docs in the Window menu either. No sign of my document at all in Word after the split second it was visible.
If I put a Msgbox statement in my LS code just after the Activate statement, Word will keep my document open until I click OK to close the Msgbox in Notes, than the doc disappears from Word. Even if I type something in it before I close the Msgbox, is disappears without a prompt to save.
Subject: MS Word object activate from Notes leaves no Word doc open
This happened to me when I borrowed the example code and used the ForAll statement to run through all the embedded objects. when I just referenced the object by number, it worked fine. so this code:
Dim workspace As New NotesUIWorkspace
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Dim i As Integer
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
Call o.activate(True)
End Forall
End If
became this
Dim workspace As New NotesUIWorkspace
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Dim i As Integer
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Set o = rtitem.embeddedobjects(0) Call o.activate(True)
End If
Subject: MS Word object activate from Notes leaves no Word doc open
On the off chance that you are receiving email notices on responses, did you ever find a solution for this? I am pulling out what little hair I have fighting the identical problem.
Global declaration does not solve things. I too can cheat with a message box but its not the way I want to go.
Subject: MS Word object activate from Notes leaves no Word doc open
G’Day Bill
I had a problem that sounds the same.
I had an action to print embedded word documents.
The action used a function in a script library.
The funtion was designed to activate the embedded word document and return the handle.
Everytime the function completed and returned control back to the action, the word doc closed.
I changed the function to return a handle to the embedded object. The action now calls object.Activate and the word document stays open.
It was weird, if I added other funtions to my script library and passed the handle to the word doc to those functions the word doc stayed open. only when I returned to the action did the word doc close.
Subject: RE: MS Word object activate from Notes leaves no Word doc open
I had similar problem recently.I discover in an article that the variable containing reference to the newly ole object (word app) as to be a global variable… Then everything work much better…
example :
Set object = body.EmbedObject( 1453, "Word.Document", "")
Set Hdl=object.Activate(True)