COM Automation Menubar disappear

S

Sven Passig

Hi there,

i have a strange error during a COM Automation of Excel in a VisualC++
Programm with MFC Dispatcher Classes.
Sometimes the ExcelMenuebar disappear.

I just make something like:

_Application m_Excel;

if(m_Excel.CreateDispatch("Excel.Application"))

....


It opens a new instance of Excel and do all my automation stuff without any
problems, but in some cases there is no Excel Standard menubar.
So I try to explicit show the menu bar with:

// make shure that the menu bar is visible

CommandBars theBars = m_Excel.GetCommandBars();


// first way

CommandBar theExcelMenuBar = theBars.GetActiveMenuBar();

theExcelMenuBar.SetEnabled(true);

theExcelMenuBar.SetVisible(true);

// second way

CommandBar theOneBar = theBars.GetItem(COleVariant((short)1));

theOneBar.SetEnabled(true);

theOneBar.SetVisible(true);


But nothing ever helped.

Any ideas?

greetings

Sven



***************************************
Sven Passig
COMsulting Gerhard Faehling GmbH
Oeverdieker Weg 6
23669 Timmendorfer Strand
Tel: 04503 / 88 10 12
Fax: 04503 / 88 10 18
E-Mail: [email protected]
Internet: www.comsulting.de
***************************************
 
Top