Error HRESULT E_FAIL has been returned from a call to a COM component.

Started by SuyogK, January 21, 2009, 06:55:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SuyogK

Hi,

Following is the line of code which i am using to call toolbar functionality from office toolbar.

public void ShowCommandBars(int pId)
{
int index;
index = pId;

Microsoft.Office.Core.CommandBars theCommandBars;
ViosCmd.Application theApplication = axDrawingControl.Window.Application;
theCommandBars = (Microsoft.Office.Core.CommandBars)
theApplication.CommandBars;

theCommandBars[pId].Position = Microsoft.Office.Core.MsoBarPosition.msoBarFloating;
theCommandBars[pId].Visible = true;
}

while executing last line (i.e theCommandBars[pId].Visible = true;)
It give me :- Error HRESULT E_FAIL has been returned from a call to a COM component.
Please give me asolution to solve the same.

thanks,
Suyog