LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default command bar problem

hi all,
i'm having a command bar problem. i have made a custom command bar,
added it to my excel application. it comes nicely just above the
formula bar with all the buttons that i have added. The problem starts
when i open another workbook with same code (i.e. an earlier version or
something), now i get another command bar with all the buttons again
and so no i have 2 command bars and duplication of buttons and of
course it looks ugly. similarily when i close one of the workbooks now,
both the command bars disappear. so then i wont have any buttons !!..
i am loading this commandbar in ThisWorkbook module. i know that if i
have the command bar loaded thru ThisWorkbook module then whenever i
open a workbook with that ThisWorkbook module, the command bar will be
loaded but i dont want that. i want only 1 command bar
here's my code ----------------------------------------
Public Sub Workbook_Open()
Call Buttons
End Sub

Private Sub Workbook_Activate()
On Error Resume Next
Application.CommandBars("Resource").Enabled = True
End Sub

Private Sub Workbook_Deactivate()
On Error Resume Next
Application.CommandBars("Resource").Enabled = False
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("Resource").Delete
End Sub

and in Buttons sub i add buttons to the Resource command bar like this
Application.CommandBars.Add("Resource",Position:=m soBarTop,
temporary:=True)

any help will be appreciated.
amit

 
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
Command Button Problem albertmb Excel Discussion (Misc queries) 6 June 22nd 08 01:06 PM
Problem with command button name Jason[_9_] Excel Discussion (Misc queries) 10 October 19th 07 09:54 PM
Subtotal command problem Martin B Excel Worksheet Functions 1 November 26th 06 01:34 PM
Problem with MID (any text) Command Scott Excel Worksheet Functions 2 May 2nd 06 09:45 PM
Macro command problem johncouzins Excel Discussion (Misc queries) 4 July 27th 05 09:10 PM


All times are GMT +1. The time now is 10:33 AM.

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"