0

I'm trying to set displaygridlines = false in Access VBA. I started with Excel to record the macro on turning this off, which give the displaygridlines=false. But this does not work in Access VBA. The only reference I could find on the site was How can I turn off gridlines in excel using VBA, without using ActiveWindow but this is for Excel.

The "Method or data member not found" is the error when compiling.

Does anyone know how to turn off gridlines in Excel from Access VBA?

dbmitch
  • 5,361
  • 4
  • 24
  • 38
LEBoyd
  • 151
  • 12

1 Answers1

0

If I understand your question correctly, you want to open a (new?) workbook in Excel from an Access VBA script and then hide the Excel gridlines. This can be done with the following code:

Private Function xlWithoutGrids()
Dim xlApp As New Excel.Application

With xlApp
    .Visible = True
    .Workbooks.Add
    .ActiveWindow.DisplayGridlines = False
End With

End Function

Make sure you have a reference to the Microsoft Excel Object library from your Access database (Tools > References).

Calaris
  • 158
  • 1
  • 1
  • 10