Link to home
Start Free TrialLog in
Avatar of jeza
jeza

asked on

Accessing OLE Objects

i have a database that stores templates (.doc, .xls .lwp ext) i create a ole objects from the templates. i can get the template, embed an ole object, open the object and pass field values to that ole object. but i can not get the object to FitToWindow when the document first opens.
i don't want the object to activate, i want the user to click on the object to activate it. how can i set the fittowindow property of the new object when creating the form?

the ui says there is an embedded object but will not update the properties.
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

In this description you will find the answer:
http://www-10.lotus.com/ldd/today.nsf/62f62847467a8f78052568a80055b380/7d432c8317c276c8852566eb00695f28?OpenDocument

It would be also interesting to see the code you have so far for the OLE institution.

Avatar of jeza
jeza

ASKER

here is the code i have in the post open of the word document.

Sub Postopen(Source As Notesuidocument)
     
     Dim s As New NotesSession    
     Dim db As NotesDatabase
     Dim doc As NotesDocument
     Dim view As NotesView
     Dim object As NotesEmbeddedObject
     Dim handle As Variant
     Dim WordObj As Variant
'check if new document, if yes create new word doc, if not open from document
     If source.IsNewDoc Then
'get the template document and extract the attachment to the hdd.
          Set db = s.CurrentDatabase
          Set view =  db.GetView("Standard Templates")
          Set templatedoc = view.GetDocumentByKey("Standard Letter",True)
          Set tmpobject = templatedoc.Getattachment("letter.doc")
          Call tmpobject.ExtractFile("c:\temp\standardletter.doc")
'through the ui go to the body field and create the object.
          Call source.gotoField( "Body" )          
          Call source.CreateObject("Letter","","c:\temp\standardletter.doc")
'setup a handle for the ole object.
          Set WordObj = source.getObject("Letter")
'Populate variables with info to pass to word and update the variables in Word document          
          WordObj.variables("Formal").value = source.fieldGetText("Formal")
          WordObj.variables("Initial").value = source.fieldGetText("Initial")
          WordObj.variables("FirstName").value = source.fieldGetText("FirstName")
          WordObj.variables("LastName").value = source.fieldGetText("LastName")
          WordObj.variables("Company").value = source.fieldGetText("Company")
          WordObj.variables("Address1").value = source.fieldGetText("Address1")
          WordObj.variables("Address2").value = source.fieldGetText("Address2")
          WordObj.variables("Address3").value = source.fieldGetText("Address3")
          WordObj.variables("City").value = source.fieldGetText("City")
          WordObj.variables("County").value = source.fieldGetText("County")
          WordObj.variables("Country").value = source.fieldGetText("Country")
          WordObj.variables("PostCode").value = source.fieldGetText("PostCode")          
          WordObj.variables("Author").value = s.commonUserName
'Activate Word, add a window for the new document and show the application
          WordObj.activate
          WordObj.Fields.Update
     Elseif source.Inpreviewpane = False Then
'Get object and activate Word.
          Set WordObj = source.getObject( "Letter" )    
          WordObj.activate
     End If
End Sub
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    PAQ with points refunded

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Zvonko
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of GhostMod
GhostMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial