View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
musa.biralo musa.biralo is offline
external usenet poster
 
Posts: 55
Default Toolbar is floating every time when excel is opened, how to dock?

Hey There Jim,
thanks a lot...
It was perfect solution and perfect match!

I just add one more line then everything worked liked charm!!!!
Thanks again....

Sub SaveToolbarPos()
With CommandBars("ABC")
SaveSetting "MyUtils", "MyToolbar", "Pos", .Position
SaveSetting "MyUtils", "MyToolbar", "Top", .Top
SaveSetting "MyUtils", "MyToolbar", "Left", .Left
SaveSetting "MyUtils", "MyToolbar", "RowIndex", .RowIndex
End With
'DeleteSetting "MyUtils", "MyToolbar"
End Sub

Sub SetToolbarPos()
With CommandBars("IDModeling")
.Position = GetSetting("MyUtils", "MyToolbar", "Pos",
msoBarFloating)
.Top = GetSetting("MyUtils", "MyToolbar", "Top", 1)
.Left = GetSetting("MyUtils", "MyToolbar", "Left", 1)
.RowIndex = GetSetting("MyUtils", "MyToolbar", "RowIndex", 1)
End With
End Sub


On Oct 9, 1:49 pm, "Jim Rech" wrote:
You can save your toolbar's position in the registry and restore it from
there like this:

Sub SaveToolbarPos()
With CommandBars("ABC")
SaveSetting "MyUtils", "MyToolbar", "Pos", .Position
SaveSetting "MyUtils", "MyToolbar", "Top", .Top
SaveSetting "MyUtils", "MyToolbar", "Left", .Left
End With
End Sub

Sub SetToolbarPos()
With CommandBars("ABC")
.Position = GetSetting("MyUtils", "MyToolbar", "Pos", msoBarFloating)
.Top = GetSetting("MyUtils", "MyToolbar", "Top", 1)
.Left = GetSetting("MyUtils", "MyToolbar", "Left", 1)
End With
End Sub

--
Jim"musa.biralo" wrote in message

ups.com...
| Hi there,
| Macro generates the toolbar and this is done by calling
| "create_toolbar" from a module. The call "create_toolbar" is in
| "Workbook_Open" event...as a result the toolbar is recreated/
| repositioned as floating.... I tried protection/position properties
| but ..nothing really helped....
|
| Recreating of toolbar is ok but not the repositioning... Is there a
| way to remember the last docking position and save that in the addins
| file... so that the x and y or something similar can be pulled from
| the xla. OR just to find out the best fit docking position....
|
| your support is triple appreciated. Thanks!
|
| musa.biralo
|