View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pgag45 pgag45 is offline
external usenet poster
 
Posts: 3
Default Correct Useage of .FindControls

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!