Group: microsoft.public.word.vba.general
From: "Julian"
Date: Sunday, February 24, 2008 12:27 PM
Subject: Re: Disappearing Commandbar buttons

"Tony Jollans" wrote in message
news:OyhyFcwdIHA.484@TK2MSFTNGP06.phx.gbl...
>I know funny things can happen sometimes with command bar customizations. I
>can't say I've ever heard of visible buttons not being in the collection
>but it wouldn't surprise me overmuch.
>
> I'm going to have to guess unless you have a repeatable scenario. Does the
> code that toggles the visibility have any context set?

Didn't think of doing that as in the same code I can access all the other
buttons and (as stated) I think they all have the same nominal context...
Yes... commandbars behave very oddly at times (there's a dynamic toolbar
created at startup and sometimes (95%) I can copy & paste the button faces
from the (hidden) template toolbar and sometimes (5%) I can't for no obvious
reason at all...

>Alternatively it may be that there is some corruption in the original
>customized toolbar (if so it can be enormously difficult to get rid of).

Hmmmm.... suppose I could try rebuilding it by copying the items into a new
bar and hope the corruption doesn't go with them!

> I must say the idea of doing animation by toggling the visibility of
> toolbar buttons horrifies me :)

Not as much as some of the other stunts pulled to work around Word
limitations & oddities (esp. re Reviewing Pane) would horrify I expect :)

>- although I know of no reason why it shouldn't work in theory.

Indeed. Does in fact work until such time as the VBA IDE finds a compile
error when I am fiddling with new stuff (though I have turned off background
compile option it still happens when I make a proper mistake), though why it
should affect this area so specifically and exclusively who (neither of us,
clearly) knows?

> Sorry, none of this is very helpful. I haven't really got any idea what
> might cause this.

Not being very helpful is sometimes very helpful indeed - much appreciate
null input! One does wonder whether there is some glaringly obvious but (to
the author) invisible problem/solution and it's nice to know one hasn't gone
totally blind!

Thanks...

--
Julian I-Do-Stuff

Some Vista stuff, but mostly just Stuff at http://berossus,blogspot.com
> "Julian" wrote in message
> news:ekvrU0udIHA.4476@TK2MSFTNGP06.phx.gbl...
>> "Tony Jollans" > My best guess would be that the original customization
>> and the latest one
>>> adding the two new buttons had different contexts - in other words were
>>> stored in different templates or documents.
>>
>> Thanks - that's an interesting idea... however, all controls (on this
>> bar) were created by Customizing the toolbar in Word itself (not by
>> adding controls in VBA) and so should have been in the Normal template
>> context, and I've just inspected the commandbar controls and they all
>> seem to belong to Normal...
>>
>> The only thing I am doing with these buttons is turning them on and off
>> alternately (visible true/false) to create a crude animation...
>>
>> Worth pointing out that when they both disappear from the commandbar
>> controls collection, at least one is still visible on the command bar
>> itself (the other one probably still being invisible but "present")
>>
>> Odd! What's your second best guess?
>>
>> --
>> Julian I-Do-Stuff
>>
>> Some Vista stuff, but mostly just Stuff at http://berossus,blogspot.com
>>
>>> "Julian" wrote in message
>>> news:eCULp%23VdIHA.2268@TK2MSFTNGP02.phx.gbl...
>>>> [Word 2002/XP] I have a custom command bar with many buttons... but the
>>>> two most recently added (invoking trivial macros) seem to disappear
>>>> from the Controls collection even though they are still visually
>>>> present on the command bar itself... (Word has been restarted since the
>>>> original customisation)
>>>>
>>>> It only seems to happen after the VBA IDE has complained about a
>>>> compile error though... and all the other buttons are fine...
>>>>
>>>> Any ideas?
>>>>
>>>> NB - when I say they disappear from the Controls collection I mean that
>>>> having iterated through all of them they just aren't there anymore, not
>>>> that e.g. the referencing "name" has been corrupted
>>>>
>>>> --
>>>> Julian I-Do-Stuff
>>>>
>>>> Some Vista stuff, but mostly just Stuff at http://berossus,blogspot.com
>>
>

Safety Articles | Usenet Groups | Usenet News | Bluegrass