Hello guys I 've been digging for a while trying to add nice image to CommandBarButton in MS Word using VS 2005 without aby luck. I found http://blogs.msdn.com/vsto/archive/2003/12/18/44404.aspx and http://support.microsoft.com/default.aspx?scid=kb;en;288771 second one gives very good exmaple for merging image and mask in Clipboard and paste face on button at once. there is some code for creating mask image from source but it is on VB6 and it is quite inconvinient (and impractical) to keep using API function while most of them has their .NET equivalents. does anyone know some example of this in .NET? I tried to load them in sample VB.NET 2005 project but I get ComException on ..PasteFace() this is the code buttonInsert = .Controls.Add(Type:=Core.MsoControlType.msoControlButton) With buttonInsert .Caption = "Insert Snippet" Try My.Computer.Clipboard.SetData("Toolbar Button Face", My.Resources.ToolbarIcons.Manage) My.Computer.Clipboard.SetData("Toolbar Button Mask", My.Resources.ToolbarIcons.Mask) .PasteFace() Catch ex As Exception Debug.WriteLine(ex.Message) End Try I am sure images are correct because I created them with code from MS Office VBA help file (artice for CommadBarButton.Picture property) Thank you in advance -- Galin Iliev [MCSD, MCSD.NET] Senior Software Developer www.wordassist.com
Hi Galin, > I 've been digging for a while trying to add nice image to CommandBarButton > in MS Word using VS 2005 without aby luck. > I found http://blogs.msdn.com/vsto/archive/2003/12/18/44404.aspx and > http://support.microsoft.com/default.aspx?scid=kb;en;288771 > second one gives very good exmaple for merging image and mask in Clipboard > and paste face on button at once. there is some code for creating mask image > from source but it is on VB6 and it is quite inconvinient (and impractical) > to keep using API function while most of them has their .NET equivalents. > does anyone know some example of this in .NET? > > I tried to load them in sample VB.NET 2005 project but I get ComException on > ..PasteFace() > Since Office 2002 you don't need to use PasteFace to change the icon on a toolbar button. Look up the PICTURE property of the CommandBarButton object (Office object library). Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-)