I have an OCX embedded in a form. (actually a RUMBA Mainframe Display but I also tried “Microsoft Rich Textbox Control 6.0”)
Now I try to get a handle in Lotus Script
I have a button on the form with this code:
Dim ws As New NotesUIWorkspace
Dim doc As NotesDocument
Dim app As NotesEmbeddedObject
Dim Object As Variant
Set doc=ws.CurrentDocument.Document
If doc.HasEmbedded Then
Set app=doc.EmbeddedObjects(0)
Set Object=App.Object
End If
This gives me a “type mismatch” in the line
“Set Object=App.Object”
I also tried
Set Object=app.Activate(True)
this brings me a kind of new instance of the ocx (a little window appears) but i can not send any commands to the ocx on the form
what am I doing wrong??
Thanks for any hint
Walter
Subject: Maybe this will help?
Get attachment from one document and move it to another doc1) script pulls the attached doc in “form 1 view”
- sets filename to the name of attachment and outputs name
in a messagebox
-
extracts file to the "c:" directory
-
sets object for the second doc in “form 2 view”
-
attaches it to the rtfield in the second view
-
in both cases there was only one doc in the view
Sub Click(Source As Button)
Dim session As New notessession
Dim db As notesdatabase
Dim doc As NotesDocument
Dim rtitem, rtitem2 As Variant
Dim view, view2 As NotesView
Dim firstDoc, secdoc As NotesDocument
Dim filename As String
Dim object As notesembeddedobject
Set db = session.currentdatabase
Set view = db.GetView( "form 1 view" )
Set firstDoc = view.GetFirstDocument
Set rtitem = firstdoc.GetFirstItem( "field_rtf1" )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
Messagebox "filename: " & o.name
filename = "c:\" & o.name
If ( o.Type = EMBED_ATTACHMENT ) Then
Call o.ExtractFile( filename )
Set view2 = db.GetView( "form 2 view" )
Set secDoc = view2.GetFirstDocument
Set rtitem2 = secdoc.GetFirstItem( "field_rtf2" )
Set object = rtitem2.embedobject(embed_attachment, "", filename)
Call secdoc.save(True, True)
End If
End Forall
End If
End Sub
Subject: RE: Maybe this will help?
Hi
My problem did not concern any file attachments.
Sorry if this was not understandable enough.
Thank you anyway
P.S.
I found a solution now
I have to use uidoc.GetObject…
Walter