Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
TK TK is offline
external usenet poster
 
Posts: 177
Default ToolBar Conflict

Hi

In creating a toolbar with the following code if I attempt to
set the position of the toolbar with either of the two methods as
noted below the sheet selector as in clicking on sheet1, sheet2
ect will not work until you enter data in a cell or move or
adjust the page.

Sub NewToolBar()
Dim cbrCommandBar As CommandBar
Dim cbcCommandBarButton As CommandBarButton

' If the command bar exits, remove it.
On Error Resume Next
Application.CommandBars("My CommandBar").Delete

' Add the command bar to the application's
' CommandBars collection.

'With this line the sheet selector works but obviously the bar
'position is default
Set cbrCommandBar = Application.CommandBars.Add("My CommandBar")

If this line of code is un-hyphenated the sheet selector will not work.
'Application.CommandBars("My CommandBar").Position = msoBarTop

If this line of code is used in place of the previous two the
sheet selector will not work.
'Set cbrCommandBar = Application.CommandBars _
'.Add(Name:="My CommandBar", Position:=msoBarTop, Temporary:=True)

cbrCommandBar.Visible = True
End Sub

Sub RemoveCommandBar()
On Error Resume Next
Application.CommandBars("My CommandBar").Delete
End Sub

Doug from this newsgroup tested the procedure on WinXP, XL 2003
without a problem. I tested it on Win98 without a problem. I tested it
on two different computer using Windows XP Home Edition 2002
and it fails or freezes the page selector.
I would appreciate any advice or testing of the procedure. I included
the procedure to delete the toolbar for anyone that test it.

Thanks
TK

  #2   Report Post  
Posted to microsoft.public.excel.programming
TK TK is offline
external usenet poster
 
Posts: 177
Default ToolBar Conflict

Hi

In a PS to the previous post, all of the following
settings work except msoBarTop

Set cbrCommandBar = _
Application.CommandBars.Add(Name:="MyCommandBar", Position:=msoBarTop)

'Set cbrCommandBar = _
Application.CommandBars.Add(Name:="MyCommandBar", Position:=msoBarLeft)

'Set cbrCommandBar = _
Application.CommandBars.Add(Name:="MyCommandBar", Position:=msoBarRight)

'Set cbrCommandBar = _
Application.CommandBars.Add(Name:="MyCommandBar", Position:=msoBarBottom)

'Set cbrCommandBar = _
Application.CommandBars.Add(Name:="MyCommandBar", Position:=msoBarFloating)

Thanks


"TK" wrote:

Hi

In creating a toolbar with the following code if I attempt to
set the position of the toolbar with either of the two methods as
noted below the sheet selector as in clicking on sheet1, sheet2
ect will not work until you enter data in a cell or move or
adjust the page.

Sub NewToolBar()
Dim cbrCommandBar As CommandBar
Dim cbcCommandBarButton As CommandBarButton

' If the command bar exits, remove it.
On Error Resume Next
Application.CommandBars("My CommandBar").Delete

' Add the command bar to the application's
' CommandBars collection.

'With this line the sheet selector works but obviously the bar
'position is default
Set cbrCommandBar = Application.CommandBars.Add("My CommandBar")

If this line of code is un-hyphenated the sheet selector will not work.
'Application.CommandBars("My CommandBar").Position = msoBarTop

If this line of code is used in place of the previous two the
sheet selector will not work.
'Set cbrCommandBar = Application.CommandBars _
'.Add(Name:="My CommandBar", Position:=msoBarTop, Temporary:=True)

cbrCommandBar.Visible = True
End Sub

Sub RemoveCommandBar()
On Error Resume Next
Application.CommandBars("My CommandBar").Delete
End Sub

Doug from this newsgroup tested the procedure on WinXP, XL 2003
without a problem. I tested it on Win98 without a problem. I tested it
on two different computer using Windows XP Home Edition 2002
and it fails or freezes the page selector.
I would appreciate any advice or testing of the procedure. I included
the procedure to delete the toolbar for anyone that test it.

Thanks
TK

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
Name conflict smaruzzi Excel Discussion (Misc queries) 3 October 4th 08 01:44 PM
Name Conflict Roger[_4_] Excel Discussion (Misc queries) 2 March 15th 08 01:13 AM
Name Conflict Roger[_4_] Excel Discussion (Misc queries) 5 March 14th 08 02:14 PM
Conflict MathewPBennett Excel Programming 3 December 22nd 03 09:29 PM
Conflict Don Lloyd Excel Programming 2 October 11th 03 11:44 PM


All times are GMT +1. The time now is 02:05 AM.

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

About Us

"It's about Microsoft Excel"