Group: microsoft.public.word.vba.general
From: "Tony Jollans"
Date: Sunday, February 24, 2008 11:01 AM
Subject: Re: Disappearing Commandbar buttons

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? 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).

I must say the idea of doing animation by toggling the visibility of toolbar
buttons horrifies me :) - although I know of no reason why it shouldn't work
in theory.

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

--
Enjoy,
Tony

"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
>