View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
sifar sifar is offline
external usenet poster
 
Posts: 22
Default Creating a Custom commandbar button

Hi Dave,

Its nothing to with your code. getting the same message at a Cybercafe
PC. works fine on my Home PC.

Made some changes to your code.....

Sub CleanUpControls()
Dim cbar As CommandBar
Dim ctrl As CommandBarControl

Do
Set cbar = Nothing
Set ctrl = Nothing
On Error Resume Next
Set cbar = Application.CommandBars("PastyFellow")
Set ctrl = cbar.FindControl(Tag:="Sifar")
On Error GoTo 0

If ctrl Is Nothing Then
Exit Do
Else
ctrl.Delete
cbar.Delete
End If
Loop

End Sub

This worked fine for me by deleting the CustomCommandBar along with the
Control.

Please advice.