Buttons Won't "set" (Add to the toolbar) 
Author Message
 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.



Sat, 28 Aug 2004 23:37:58 GMT  
 Buttons Won't "set" (Add to the toolbar)
Hi Mike:

Quote:
> Buttons are not added to the Toolbar with this code, I always get an
> error 13, Type Mismatch error.

Perhaps you have two types of "Buttons" referenced.
Try qualifying the button:

Dim btn As MSComctlLib.Button

If that doesn't work, then try "As Object"

Hope this helps,

Doug.



Sun, 29 Aug 2004 00:16:35 GMT  
 Buttons Won't "set" (Add to the toolbar)
Doug,

That did the job. I most have used a different type of button. The strange
thing is that there is no evidence of this in the Properties sheet. Oh
well.

Thanks - Miles Thompson

Quote:

> Hi Mike:

> > Buttons are not added to the Toolbar with this code, I always get an
> > error 13, Type Mismatch error.

> Perhaps you have two types of "Buttons" referenced.
> Try qualifying the button:

> Dim btn As MSComctlLib.Button

> If that doesn't work, then try "As Object"

> Hope this helps,

> Doug.



Sun, 29 Aug 2004 01:39:33 GMT  
 Buttons Won't "set" (Add to the toolbar)
Hi Miles:

Quote:
> That did the job. I most have used a different type of button. The strange
> thing is that there is no evidence of this in the Properties sheet. Oh
> well.

Check you "Components" -- I suspect that you have different versions of "Microsoft Common Controls" referenced.

Doug.



Sun, 29 Aug 2004 03:14:36 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Disable "Add button" from toolbar

2. Disabling "BACK"/"FORWARD" buttons

3. Disabling "BACK"/"FORWARD" buttons

4. AppActivate "WordPerfect" won't work

5. ScriptControl.AddObject("Self",Me) - reference won't go away

6. "What's this" help button

7. make the "export" and "print" button appearing on the toolbar

8. set recordset that won't set! "#@!$!"

9. Toolbar Button Won't Delete

10. Standard toolbar button won't appear

11. Toolbar buttons won't resize after installation of SP3

12. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

 

 
Powered by phpBB® Forum Software