How to save Excel workbook object in richtext

Hello Guys,I am very new to lotus notes/lotus script

I am not sure how to attach dynamically created excel workbook object to form’s richtext field

I was able to attach local xls file using its path.

Would appreciate your quick help here

Subject: What have you tried?

Subject: RE: What have you tried?

Dim xlApp As VariantDim xlsheet As Variant

Set xlApp = CreateObject(“Excel.application”)

xlapp.SheetsInNewWorkbook = 1

Set newBook = xlApp.Workbooks.Add

sheet = 1

Set xlsheet = newBook.Worksheets(1)

xlsheet.Activate

then I am filling the sheet

I could save the workbook on local disk

newBook.SaveAs (“c:\temp\file.xls”)

But I want to store the workbook in ritchtext field of a document without saving it to local disk

I tried

Set tempview=db.GetView(“(SCD)”)

Set newdoc=tempview.GetFirstDocument

Set rtitem = newdoc.GetFirstItem(“Daily”)

ForAll j In newdoc.items

If j.type=RICHTEXT Then

If j.name=“Daily” Then

ForAll o In j.embeddedobjects

If o.type=EMBED_ATTACHMENT Then

Call o.remove

End If

End ForAll

End If

End If

End ForAll

object=rtitem.Embedobject(EMBED_ATTACHMENT,“file.xls”,“”,newBook)

Call newdoc.Save( True, True)

It is not working

Could you please help me with this?

Actually I want to do this with scheduled agent on production server

is there any other way to do this ?

Subject: RE: What have you tried?

The file doesn’t exist until it’s saved, so you can’t attach it. It doesn’t matter whether or not you want to do it, it’s still necessary.

Subject: How to save Excel workbook object in richtext

You’d have to save it as an XLS file first, then attach the file; you can’t attach an in-memory object.