Wraithchilde was telling us:
Wraithchilde nous racontait que :
>> So, again, what is your problem? It seems to me that you do not
>> really need to set the toolbar visible status to False, unless I
>> have misunderstood your situation.
>
> That IS the problem. There are times when I need to set visible to
> false and times I don't need to set visible to false. It's the times
What are those conditions that determines the toolbar visibility status?
What test does the code perform to know if the target toolbar should be
displayed or not?
> when I don't need to set it that it blows up. There's no way to catch
> it because you can't even check that the toolbar is there or not
Yes you can. With a loop you can check if a particular toolbar is available
or not. If it is not available, it is invisible (so, as I stated before, no
code needed to set its visibility status) as it does not exists in that
particular context.
> without causing an error. Not even with IsObjectValid(). So I ended
> up just wrapping all of them in on error resume next, on error goto
> 0. To me it's like a hack solution.
Again, if the code that you are using is activated from Document1 based on
template B but references a toolbar from template A, the toolbar will always
be unavailable (and invisible), so you do not need to code for that.
Can you explain again, not stating what you are trying to do with your code,
but the overall situation. Because, from your own words:
<quote>
But to try to answer all the questions, the toolbar is a template (like
toolbar.dot) in the user's startup folder. It opens a document, which is
also
a template but opens as Document1, 2, 3, etc. The above code is in this
second document. Di I get them all this time?
<unquote>
Notwithstanding the fact that it is difficult to understand what you mean by
"which is also a template but opens as Document1" (are you opening the
template itself or creating a document based on that template? I will assume
the latter.); your code should not ever throw an exception error. If the
template is truly in the user's start-up folder, then the toolbar will
always be accessible. If the code throws an error, then it means the
template is not loaded, there is a name error in the code or a coding error.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org