CreateNewItem for Excel.Sheet fails when a cell is being edited in the Formula Bar

M

Milind Phadnis

Hi,

I have an application that embeds an Excel Sheet object. The object is
created using CreateNewItem with the CLSID for "Excel.Sheet", as shown
below.
COleClientItem::CreateNewItem(clsid, render, cfFormat, lpFormatEtc)
where clsid is obtained using CLSIDFromProgID, render is
OLERENDER_DRAW and the last two parameters are 0 and NULL.
This call fails under the following circumstances.

1) Open any existing excel file
2) Click on any cell, then click in the formular bar. Notice the
cursor is blinking in the formula bar.
3) Start up my application and launch the command that tries to create
the embedded Excel sheet object.
4) CreateNewItem fails.

The function also fails when a dialog is being displayed in Excel.
e.g. if I use the Tools-Options command in Excel to display the
options dialog and then launch the relevant command in my application,
I run into the same problem.

I also observed the same behavior in VB6. I created a Standard EXE app
in VB6. I added a OLE Container control to the form and tried to
insert a Excel Worksheet object into the container when Excel was in
the state described above (cursor in the formula bar). VB6 displays an
error message "Out of Memory".

Can somebody tell me what is going on here? Do I need to use any
specific parameters to make CreateNewItem succeed?

Thanks,
Milind
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top