+ Reply to Thread
Results 1 to 2 of 2

ToolBar Conflict

  1. #1
    TK
    Guest

    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. #2
    TK
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1