Not able to assign the picture to toolbar item.
-
Hi, I have created toolbar for Excel. To one of the toolbar item i am trying associate the image. But it is failing. stdole.IPictureDisp p = AxHost.GetIPictureDispFromPicture(image) as stdole.IPictureDisp; commandBarButton.Picture = p; When I am trying to assigning to command bar picture it is throwing following error. Error HRESULT E_FAIL has been returned from a call to a COM component. (source: Office) Exception info:System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at Microsoft.Office.Core._CommandBarButton.set_Picture(IPictureDisp ppdispPicture) Based on some events this tool bar image is changing. I am not sure why it failing.But same thing is working for menu bar item. Please help.
-
Hi, I have created toolbar for Excel. To one of the toolbar item i am trying associate the image. But it is failing. stdole.IPictureDisp p = AxHost.GetIPictureDispFromPicture(image) as stdole.IPictureDisp; commandBarButton.Picture = p; When I am trying to assigning to command bar picture it is throwing following error. Error HRESULT E_FAIL has been returned from a call to a COM component. (source: Office) Exception info:System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at Microsoft.Office.Core._CommandBarButton.set_Picture(IPictureDisp ppdispPicture) Based on some events this tool bar image is changing. I am not sure why it failing.But same thing is working for menu bar item. Please help.
-
Are you sure
p
is notnull
? /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com