
Buttons Won't "set" (Add to the toolbar)
Buttons are not added to the Toolbar with this code, I always get an
error 13, Type Mismatch error. It worked OK in a small test form. I'm
stymied. what's gone wrong, what obvious thing am I missing?
It doesn't matter which of the two "Set btn = " constructs are used,
same error is reported.
All of this is on the same from, all control names have been checked, as
have button indexes in the image list. "Option Explicit" is in General
Declarations. "btn" has been checked throughout the Sub to ensure that
it's not set to another type.
Miles Thompson
Heres the code fragment ...
Sub Form_Load
Dim btn as Button
With Toolbar1
.Align = vbAlignNone
.BorderStyle = ccFixedSingle
.Appearance = ccFlat
.TextAlignment = tbrTextAlignBottom
.Wrappable = False
.AllowCustomize = False
.ImageList = ImageList1
.HotImageList = ImageList1
.style = tbrFlat
Set btn = .Buttons.Add(1, "open", "Open", 0, "open")
'Set btn = .Buttons.Add(, , , tbrDefault, 1)
.
.
.
End With
and so forth to End Sub.