LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Creating a Custom commandbar button

First, I think I'd move that cbar stuff out of the loop.

Option Explicit
Sub CleanUpControls()
Dim cbar As CommandBar
Dim ctrl As CommandBarControl
Set cbar = Nothing
Set ctrl = Nothing

Set cbar = Application.CommandBars("PastyFellow")

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

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

cbar.Delete

End Sub

Second, on the troublesome pc, look under Tools|References.

If you see a reference marked MISSING, then maybe unchecking that reference
would fix the problem. I've never seen this error with a constant, though--but
it'll be easy to check.




sifar wrote:

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.


--

Dave Peterson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to exchange Custom Commandbar buttons between PC's? Frank Van Eygen[_2_] Excel Discussion (Misc queries) 3 April 10th 09 01:01 PM
Custom Commandbar Stefano Condotta Excel Programming 2 March 3rd 05 07:00 PM
static commandbar Button Hari Excel Programming 0 June 22nd 04 10:50 AM
Creating a CommandBar - what's wrong? Eager2Learn Excel Programming 5 May 1st 04 05:02 PM
Value of ComboBox on Custom CommandBar Kevin Excel Programming 4 January 15th 04 10:25 PM


All times are GMT +1. The time now is 01:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"