Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default how to limit custom toolbar's display

Hi, all

I am working on an application in Excel and I add a new toolbar to
excel by coding VBA. Here's the way that I wrote like:

Application.CommandBars.Add Name:= "My Toolbar", Temporary:=True

But if I open other excel workbooks at the same time, the toolbar also
appears in the window of those workbooks. It's really annoying and
leads to mistakes. Is there any way to prevent the toolbar displaying
in unrelated workbooks?

Thanks for any suggestions.

Dingding
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default how to limit custom toolbar's display

On Nov 19, 3:13 pm, Dingding wrote:
Hi, all

I am working on an application in Excel and I add a new toolbar to
excel by coding VBA. Here's the way that I wrote like:

Application.CommandBars.Add Name:= "My Toolbar", Temporary:=True

But if I open other excel workbooks at the same time, the toolbar also
appears in the window of those workbooks. It's really annoying and
leads to mistakes. Is there any way to prevent the toolbar displaying
in unrelated workbooks?

Thanks for any suggestions.

Dingding


Hi
If your code that inserts the menu is called CreateMenu() and your
code that removes the menu is called DestroyMenu() then create these
two subs in the ThisWorkBook code module;

Private Sub Workbook_Activate()
Call CreateMenu
End Sub
Private Sub Workbook_Deactivate()
Call DestroyMenu
End Sub

The Create and Destroy subs would be what you would have in your Open
and BeforeClose macros to add and remove the menu when you open/close
Excel.

regards
Paul
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default how to limit custom toolbar's display

On 11ÔÂ19ÈÕ, ÏÂÎç11ʱ22·Ö, wrote:
On Nov 19, 3:13 pm, Dingding wrote:

Hi, all


I am working on an application in Excel and I add a new toolbar to
excel by coding VBA. Here's the way that I wrote like:


Application.CommandBars.Add Name:= "My Toolbar", Temporary:=True


But if I open other excel workbooks at the same time, the toolbar also
appears in the window of those workbooks. It's really annoying and
leads to mistakes. Is there any way to prevent the toolbar displaying
in unrelated workbooks?


Thanks for any suggestions.


Dingding


Hi
If your code that inserts the menu is called CreateMenu() and your
code that removes the menu is called DestroyMenu() then create these
two subs in the ThisWorkBook code module;

Private Sub Workbook_Activate()
Call CreateMenu
End Sub
Private Sub Workbook_Deactivate()
Call DestroyMenu
End Sub

The Create and Destroy subs would be what you would have in your Open
and BeforeClose macros to add and remove the menu when you open/close
Excel.

regards
Paul


Hi,

Your suggestion works! Thanks a lot. :-)

Dingding
Reply
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
Custom filter limit removed in 2007? Anthony Excel Discussion (Misc queries) 1 April 8th 11 02:09 PM
Custom list 255 character limit too small Minister1 Excel Discussion (Misc queries) 1 October 26th 09 12:27 PM
Format Cell as custom type but data doesn't display like I custom. ToMMie Excel Discussion (Misc queries) 6 September 11th 08 08:31 AM
A1:R42 display limit Ian Setting up and Configuration of Excel 2 December 21st 05 09:49 AM
Toolbar's shape remains on the screen Haldun Alay[_3_] Excel Programming 2 October 15th 03 08:15 PM


All times are GMT +1. The time now is 06:46 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"