Accessing OLE Objects

jeza
jeza used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Zvonko זְאֵבSystems architect
Top Expert 2006

Commented:
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.

Author

Commented:
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
Zvonko זְאֵבSystems architect
Top Expert 2006

Commented:
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
Commented:
PAQed, with points refunded (50)

GhostMod
Community Support Moderator

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial