|
-
Jan 27th, 2006, 08:41 AM
#1
Thread Starter
Lively Member
checking if a control exists - please help
hi there
i need to check first that a control exists before adding new one,
how do i do this
i have the following code, but im not sure how to check if the control object is filled or not
VB Code:
Dim testcontrol As Office.CommandBarControl
Set testcontrol = objApp.ActiveExplorer.CommandBars.item("Menu Bar").controls.item("My Control")
If testcontrol = false Then
'add control
else
'control exists
end if
alternatively, is there some way chekc if a control exists like
objApp.ActiveExplorer.CommandBars.item("Menu Bar").controls.exists("my control")
i am using vb6, outlook 2000+
many thanks
Jamie
Last edited by jamielawjen; Jan 27th, 2006 at 08:45 AM.
-
Jan 27th, 2006, 09:26 AM
#2
Lively Member
Re: checking if a control exists - please help
Most if not all examples I've seen of commandbar manipulation involve deleting the old control and adding the new one instead of figuring a way to check for it's existance.
VB Code:
Sub RemoveControl()
On Error Resume Next
objApp.ActiveExplorer.CommandBars.item("Menu Bar").controls.item("My Control").Delete
End Sub
Sub AddControl()
Call RemoveControl
objApp.ActiveExplorer.CommandBars.item("Menu Bar").Controls.Add(....)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|