Commandbar Visibility

M

Marian

I have a Word VBA application that displays different commandbars depending
on the template that is currently open. I am now getting an error when using
the visible method for the commandbar. I researched it on the Microsoft
website and they have acknowledged it to be a problem but offer no solution.
Does anyone have a solution?

Thanks!

Marian
 
J

JuneTheSecond

Visible might not be a method but property, so it should be set to true.
Object.Visible=True
 
M

Marian

I am getting the error "Method 'Visible' of object 'CommandBar' failed." The
commandbars are custom, uniquely named, and are set to "visible" depending on
the opened template.
 
J

JuneTheSecond

For my joy i made a macro that print out the results of visible property.
Visible is property not method.

Option Explicit

Sub Command_Bars()
Dim ComBar As CommandBar
Dim KeepIt As Boolean
On Error Resume Next
For Each ComBar In Application.CommandBars
KeepIt = ComBar.Visible
Err.Number = 0
ComBar.Visible = True
If Err.Number = 0 Then
Debug.Print ComBar.Name, ComBar.Visible
Else
Debug.Print ComBar.Name, ComBar.Visible, ">>> Visible Property
Failed"
End If
ComBar.Visible = KeepIt
Next ComBar
End Sub
 

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