缺少Excel图形格式窗格

时间:2017-11-22 11:57:43

标签: excel vba excel-vba graph pane

前段时间,我用宏打开了一个旧的excel文件。然后我失去了许多excel的功能,比如上下文菜单,数据透视表字段列表窗格等。我用vba代码解决了很多这些功能,但我还没能解决这个问题:

我无法打开图形格式窗格(当您右键单击图表元素“xxx”时右键显示的窗格并点击格式“xxx”...)。

我已经尝试过excel选项,但在那里找不到任何解决方案。此外,在我之前的研究中获取上下文菜单,我找到了使用vba代码的解决方案。因此,我猜这将有一个类似的解决方案。问题是我找不到合适的vba类,方法或函数来解决这个问题。

提前致谢。

2 个答案:

答案 0 :(得分:0)

这可以帮到你: 来自Expert Exchange的Michael Fowler的积分 这是link

Sub ShowAllToolbars()
       'loop variable
       Dim i As Integer

       ' Loop through the total number of toolbars.
       For i = 1 To Application.Toolbars.Count

           ' Show each toolbar.
           Application.Toolbars(i).Visible = True
Application.CommandBars(140).Enabled=True
       ' End of loop.
       Next i

   End Sub

答案 1 :(得分:0)

我终于解决了它。

首先,我使用以下代码在工作表中列出了CommandBars的所有名称:

Dim i As Integer
Dim bar As CommandBar
i = 0

For Each bar In Application.CommandBars
  i = i + 1
  Sheets("Sheet1").Cells(i, 1) = bar.Name    
Next

这不是必需的,我只是想学习CommandBars的名字。

经过一些反复试验后,我发现下面的代码完成了这项工作:

Application.CommandBars("Format Object").Enabled = True

上一个答案中的代码

Application.CommandBars(140).Enabled=True

可能会做同样的事情,但我无法使其发挥作用。