Why does my macro display this BASIC runtime error message: Property or method not found: ViewSettings.
I am trying to show the grid lines on Sheet1 and not show them on all other sheets
Sub ShowGridlinesOnlyOnSheet1
Dim oDoc As Object
Dim oSheets As Object
Dim oSheet As Object
Dim i As Integer
oDoc = ThisComponent
oSheets = oDoc.Sheets
For i = 0 To oSheets.getCount() - 1
oSheet = oSheets.getByIndex(i)
If oSheet.Name = "Sheet1" Then
oSheet.ViewSettings.ShowGrid = True 'This is where the error occurs
Else
oSheet.ViewSettings.ShowGrid = False
End If
Next i
End Sub