ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Toolbar position (https://www.excelbanter.com/excel-programming/418552-toolbar-position.html)

Spencer

Toolbar position
 
I have a custom toolbar created when a worksheet is opened, however I want to
place it next to another toolbar everytime it is opened. I have used the
following code:

MyBar.RowIndex = Application.CommandBars("OtherBar").RowIndex
MyBar.Left = Application.CommandBars("OtherBar").Left

This would work except that at my work we have another toolbar that is
created anytime excel is opened and that is the toolbar I want it next to and
the code for my bar is running first so I get an error.

How do I make it so my toolbar isn't created until the other toolbar has
been created?

Jim Rech

Toolbar position
 
Perhaps you could delay your commandbar creating sub. Instead of calling it
directly in your Auto_Open or Workbook_Open sub:

AddMyCmdbar

you could call it like this:

Application.OnTime DateAdd("s", 3, Now), "AddMyCmdbar"

--
Jim
"Spencer" wrote in message
...
|I have a custom toolbar created when a worksheet is opened, however I want
to
| place it next to another toolbar everytime it is opened. I have used the
| following code:
|
| MyBar.RowIndex = Application.CommandBars("OtherBar").RowIndex
| MyBar.Left = Application.CommandBars("OtherBar").Left
|
| This would work except that at my work we have another toolbar that is
| created anytime excel is opened and that is the toolbar I want it next to
and
| the code for my bar is running first so I get an error.
|
| How do I make it so my toolbar isn't created until the other toolbar has
| been created?



All times are GMT +1. The time now is 02:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com