vba CommandBars assigning visible property giving error message

Charles Kenyon 159.6K Reputation points Volunteer Moderator
2020-01-16T14:35:03+00:00

The following command in the immediate window results in an error. According to the documentation, it should simply make the Styles Pane visible.

  application.CommandBars("Styles").visible = True

Here is the support page for the CommandBars.Visible property:

https://docs.microsoft.com/en-us/office/vba/api/office.commandbar.visible?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev11.query%3FappId%3DDev11IDEF1%26l%3Den-US%26k%3Dk(vbaof11.chm3020)%3Bk(TargetFrameworkMoniker-Office.Version%3Dv16)%26rd%3Dtrue%26f%3D255%26MSPPError%3D-2147217396

The following in the immediate window will report True or False:

  ? application.CommandBars("Styles").visible

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Charles Kenyon 159.6K Reputation points Volunteer Moderator
    2020-01-16T19:27:54+00:00

    I am able to change the .width property, just not the .visible property.

    This error occurs after the .enabled property is set to True.

    2 people found this answer helpful.
    0 comments No comments