tags:

views:

29

answers:

1
Private Sub hideHeadings()
  Dim obj As Window
  For Each obj In Application.Windows
    obj.DisplayHeadings = False
  Next obj

End Sub

The above is my attempt, as when I recorded code to do it it goes ActiveWindow.DisplayHeadings = false. But I must be missing something. Please help thanks in advance.

+3  A: 

I think there is nothing you can do with that except iterating on each worksheet. I succeed with this code

Private Sub hideHeadings()
  Dim wrkbk As Workbook
  Dim wrksh As Worksheet
  Dim prev As Window

  Set prev = ActiveWindow

  For Each wrkbk In Workbooks
    For Each wrksh In wrkbk.Worksheets
        wrksh.Activate
        ActiveWindow.DisplayHeadings = False
    Next wrksh
  Next wrkbk

  prev.Activate

End Sub
Bart