Excel Embedded Object on document is always Read-Only

I am creating an Excel spreadsheet through a LotusScript agent and embedding it on a form:

Creating the Excel Object:

Set excelApp = CreateObject(“Excel.Application”)

excelApp.DisplayAlerts = False

excelApp.Visible = False

Set excelNewWkbk = excelApp.Workbooks.Add

Set excelSheet = excelNewWkbk.ActiveSheet

Saving the Excel Object:

Call excelNewWkbk.SaveAs(fileName)

Embedding the Object:

Set embedItem = New NotesRichTextItem(doc, “bl_Sheet”)

Set embedObject = embedItem.EmbedObject(EMBED_OBJECT, “”, fileName)

Each time I attempt to open the embedded object on the Notes document, I receive:

“This document is read-only. If you make any changes in the OLE object they cannot be saved because the document is read-only.”

The Notes document itself is in edit mode and does not have any Reader/Author fields on it.

So, I turned my attention to the embedded object being in read-only mode — the SaveAs method. I recorded a macro in Excel and pulled into my agent – there is a parameter when using the SaveAs method called “ReadOnlyRecommended,” which is set to False:

ActiveWorkbook.SaveAs Filename:=“C:\myDoc.xls”, FileFormat:=xlNormal, Password:=“”, WriteResPassword:=“”, ReadOnlyRecommended:=False, CreateBackup:=False

I tried these 3 ideas for using the SaveAs method (vbNormal = 0):

  1. Call excelNewWkbk.SaveAs(fileName, vbNormal, Null, Null, False, False)

  2. Call excelNewWkbk.SaveAs(fileName, vbNormal, , , False, False)

  3. Call excelNewWkbk.SaveAs(fileName, vbNormal, “”, “”, False, False)

Each returned with:

“Error (213): Microsoft Excel: SaveAs method of workbook class failed.”

Is it how I open/create the Workbook? Is there a parameter to set to editable and not read-only?

Do I have to close the excelApp object after saving the spreadsheet, then open and use the SetFileAttr method in LotusScript (vbNormal = 0):

fileNum% = Freefile()

Open fileName For Output As fileNum%

Close fileNum%

Setfileattr fileName, vbNormal

I have found a few threads on this issue, some good ideas, but not the solution for me:

http://www-10.lotus.com/ldd/46dom.nsf/DateAllFlatweb/dc09168723293c9885256b9e004dd58b?OpenDocument

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/9a294bcb7d88566a85256d57006dbadb?OpenDocument

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/f59e81e162969731852567c8005f7d24?OpenDocument

Any help would be great…

Thanks,

Dan

Subject: Excel Embedded Object on document is always Read-Only

Just a thought. Try this:Call excelNewWkbk.SaveAs (fileName, xlnormal, “”, “”, False, False)

where you’ve defined:

Const xlnormal = -4143

Subject: RE: Excel Embedded Object on document is always Read-Only

I did not get any error when using SaveAs, however, still getting the “read-only” message when opening the embedded object from the Notes document…

Thanks for the help!

Dan

Subject: RE: Excel Embedded Object on document is always Read-Only

Was this ever resolved, I think my issue is along the same lines.http://www-10.lotus.com/ldd/nd85forum.nsf/7756aedc25e6d81285256324005ac76c/0f89576fbd3525d18525770a000037d2?OpenDocument