Search code examples
vbaexcelgraphpane

Excel graph format pane missing


Some time ago, I opened an old excel file with a macro. Then I lost many functionalities of excel, like context menus, pivot table field lists pane etc. I've solved many of them with vba codes, but I have not been able to solve this one yet:

I cannot open graph format panes (the ones that appear on the right when you right click a chart element "xxx" and click format "xxx" ...).

I've already tried excel options and found no solution there. Also, in my previous research to get context menus back, I've found a solution using vba codes. Therefore, I guess this will have a similar solution. The problem is that I could not find the right vba class, method or function to solve this.

Thanks in advance.


Solution

  • I have finally solved it.

    First, I have listed all the names of CommandBars in a sheet using the code below:

    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
    

    This was not necessary, I just wanted to learn the names of CommandBars.

    After some trial and error, I have found out that the code below does the job:

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

    The code from the previous answer

    Application.CommandBars(140).Enabled=True
    

    probably does the same thing but I could not make it work.