0
votes

I want to save an OLE Excel Object (MS Excel 2000 format) within a Lotus Notes document to make it available to MAC and Browser Users. After I attached it to a new Notes document MS Excel 2010 does not open it correctly. The file itself seems to be somehow valid, as I can detach and preview it with IE or Windows Explorer or even with the Lotus Notes preview. Only MS Excel 2010 is somehow unable to display the Excel document.

Here my code to extract the OLE file to file system:

dirLN = s.GetEnvironmentString("Directory",True)
subdirLN = "\"

Select Case dokArt
    Case "Excel"
        anhangLN = "anhang.xlsx"
    Case "PowerPoint"
        anhangLN = "anhang.pptx"
    Case "Word"
        anhangLN = "anhang.docx"
    Case Else
        Exit function
End Select

Set rtitem = doc.GetFirstItem("Body")

For i = 0 To UBound(rtitem.EmbeddedObjects)
    Set objDoc = rtitem.EmbeddedObjects(i)
    dateiLN =dirLN+subdirLN+anhangLN

    Set oHandle = objDoc.Activate(False)    
    Call oHandle.savecopyAs(dateiLN)
Next

and this is how I attach it back to a document

    'Anhang anhängen
Set rtItem = New NotesRichTextItem(doc,"Body")
Call rtItem.Embedobject(1454, "", dateiName)

What can I do to save the Excel file in the correct format ? I tried several ways, but I could not find any alternative to the 'savecopyas' method within the handle.

1
If the object is Excel 2000, then it can't actually be .xlsx format, can it? (If memory serves me right, .xlsx format was introduced with Excel 2007.) So perhaps Excel 2010 sees the .xlsx extension and can't deal with the fact that the data is really the older format. What happens if you save to a .xls file instead of .xlsx?Richard Schwartz
I second Richard's first impressionAndrew Magerman

1 Answers

0
votes

I think you're saying after any kind of detachment, you can't open the document with Excel, in which case the comments already provided probably apply

But in case you mean it doens't open on the screen right away ..

The Notes help quotes re Activate method :

Activate :

Syntax Set handleV = notesEmbeddedObject.Activate( show )

Parameters show Boolean. If True, the server application displays its user interface. If False, the server application hides its user interface.

If this is running on the user's client, the False in your Activate method is asking it not to display.