Floating Toolbar Questions

S

Shatin

I have added a toolbar to a workbook with following code:

Set cbar = Application.CommandBars.Add(Name:="Custom Toolbar", _
Position:=msoBarFloating, Temporary:=True)
cbar.Visible = True

1. Why is that, even though I have Temporary:=True, the toolbar will not go
away when I close the file? I have to put a macro in the
Workbook_BeforeClose event to delete the toolbar.

2. When the workbook is opened, the toolbar appears somewhere in the middle
of the workbook, whereas I would like to it to be somewhere in the top right
corner. Is there any way I can control the initial position of a floating
toolbar? If so, how?

TIA.
 
R

Rob van Gelder

1. Temporary means that it wont remain after Excel is closed, not the
workbook. You should use Workbook_BeforeClose to kill your toolbar.

2. Set the Position argument to msoBarTop
 
S

Shatin

Thanks for your help again, Rob!

Rob van Gelder said:
1. Temporary means that it wont remain after Excel is closed, not the
workbook. You should use Workbook_BeforeClose to kill your toolbar.

2. Set the Position argument to msoBarTop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top