Hi, i have seen from a Google that the following code in VB6 which is part of a custom install, publish and set up of a Form for Outlook (below is the ‘add toolbar button’ bit) will not work. The IPictureDisp object apparently cannot be used from outside the VBA when it comes to the .Picture and .Mask method.
Guess what my question is…
Yes, is there ANY WAY to programmatically add an icon image to a newly created toolbar button from outside Outlook ? I am not so hopeful, i know there is an ‘addin’ method documented by MS, I suppose it would be possible to make this add-in, then ‘add it’ via the VB6 and run it so that it does what i want.
Alternatively, i may have to just leave it with text, or a default image…. and I spent all that time making my icon and mask!! Oh well…
Dim picon As stdole.IPictureDisp, pmask As stdole.IPictureDisp
Set pIcon = stdole.StdFunctions.LoadPicture(“C:OutlookFormsImage.bmp”)
Set pMask = stdole.StdFunctions.LoadPicture(“C:OutlookFormsMask.bmp”)
‘ add the button
Set cmdbt = cb.Controls.Add(1) ‘ msoControlButton
With cmdbt
.Caption = “button1”
.BeginGroup = True
.HyperlinkType = 1 ‘ msoCommandBarButtonHyperlinkOpen
.ToolTipText = ‘ hyperlink here
.Style = 3 ‘ textandIcon
.Picture = pIcon
.Mask = pMask
.Visible = True
End With