Simple delete it first before you add it.
Use
On error resume next
'delete code
on error goto 0
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"pgag45" <(E-Mail Removed)> wrote in message news:B1D7D83E-A716-471A-9704-(E-Mail Removed)...
> Hey All,
>
> Not able to find any helpful resources on MSDN or by search on this forum, I
> am wondering if anyone can help me correctly use FindControls. I am creating
> a number of commandBars, but right now, just trying to get one to work now.
>
> I am trying to implement findControls, so that, before I create another
> button, it doesn't already exist... Have to check this b/c if vb IDE is
> opened while my workbook is opened, some strange things happen with
> workbook_open().
>
> Anyway, hopefully I am clear enough. Here is my code (commented line of code
> that isn't valid).
>
> Code:
>
> Public myThing5 As Office.CommandBar Public temp As
> Office.CommandBarControls Sub Workbook_BeforeClose(Cancel As Boolean)
> myThing5.Delete End Sub Sub Workbook_Open() Set temp =
> CommandBars.FindControls(, , "test") 'NOT VALID If TypeName(temp) = "Nothing"
> Then Set myThing5 = Application.CommandBars.Add("test", msoBarPopup, , True)
> End If UserForm1.Show vbModeless End Sub
>
>
> Thanks!