CommandBars: Top property

H

Howard Kaikow

Using Word 2003.



For a CommandBar, the Top property means "For docked command bars, this
property returns or sets the distance from the command bar to the top of the
docking area".



Running code structured as follows, the two command bars are created, as
desired, each on a separate row at the bottom of the window.



However, after saving and closing the template, both toolbars appear on the
same row.



Anybody got an explanation?



lngCommandBarBottomHeight = 0

Set cmdbar = appWord.CommandBars.Add(Name:="First",
Position:=msoBarBottom, Temporary:=False, MenuBar:=False)

With cmdbar

.Visible = True

.Top = lngCommandBarBottomHeight

lngCommandBarBottomHeight = lngCommandBarBottomHeight + .Height

End With



' Create controls for First command bar here



Set cmdbar = appWord.CommandBars.Add(Name:="Second",
Position:=msoBarBottom, Temporary:=False, MenuBar:=False)

With cmdbar

.Visible = True

.Top = lngCommandBarBottomHeight

lngCommandBarBottomHeight = lngCommandBarBottomHeight + .Height

End With



' Create controls for Second command bar here
 
H

Howard Kaikow

The problem also occurs in Word 2002, even if I set the Left property to 0.

Similar code, in Excel 2003 and PowerPoint 2003, does not have this problem.
 
H

Helmut Weber MVP

Hi Howard,

I had problems caused by several antivirus programms,
not by viruses,
and had to build up my pc from scratch,
maybe I'm posting this a second time.

I encountered similar problems.
The custom toolbars of my word-templates appeared
above each other instead of beside.
Couldn't fix it. No way!
But you may place the toolbars
where you want them to appear,
after e.g. autoopen or autonew has been completed,
by an ontime-macro called from the auto-macro.
One second delay was enough for me.

Helmut Weber MVP
 
H

Howard Kaikow

Ah, so it might be a 3rd party program repositioning toolbars..

I'll test one possibility by disabling NAV.

I really don't think that is the problem because all these toolbars are at
the bottom.
3rd party programs put their crap at the top.

The real problem here is that I've got an installation program that allows
users to choose whether the toolbar should go at the top or the bottom. I'm
trying to avoid the need to tell them they will have to manually position
the toolbar.
 
H

Howard Kaikow

I rebooted to a system with Office 2000.
The problem did not occur using Word 2000.

However, this is not ceteris paribus.
The Office 2000 system has Acrobat 4 and NAV 2003, the Office 2003 system
has Acrobat 5 and NAV 2004.
The Office 2003 system has Omni Page Pro Office 14, the other does not.
Etc.

I guess I have to write this issue off to the effect of some 3rd party
software.

P.S. Same problem occurs if I use msoBarTop.
 
H

Helmut Weber

Hi Howard,

I don't know why this happens.
I've encountered similar problems
and could not solve them except by
using an ontime macro in autoopen or autonew
which does the positioning of the toolbars.

Before the auto-macros aren't completed,
Word said, the toolbars weren't existent,
though I could see them on the screen.

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
H

Howard Kaikow

I found an odd workaround, which implies that tfe problem is with Word, not
with any 3rd party software.

Originally, I was creating a toolbar with several msoControlButton controls.

If I instead did the following, then the toolbar placement is correct.

Instead of directly placing the button controls on the toolbar, I put a
single popup control on the toolbar and then placed the buttons on that
single popup control.

Why the latter would cause proper toolbar placement and not the former is
beyond my comprehension.
Do not see how 3rd party software could be the issue.

This makes no sense (to me).
 

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