Excel sheet without cell borders

kuipers78

Registered User.
Local time
Today, 07:41
Joined
May 8, 2006
Messages
45
Hello,

I have written code in VBA-Access to open a blank Excel sheet and fill it with data. I am also able to change cell colors and the thickness of cell borders.

However, now I would like to disable the grey cell borders which are shown by default in the sheet. In other words: the sheet should look blank, just like a printed version. Is this possible in VBA? I would also like the window (within Excel) to maximize when the sheet is being opened. Is this possible too?

Some of the code I use to give you an idea:

Code:
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Visible = True

ExcelSheet.ActiveSheet.cells(6, 1).Value = "Some text here"
ExcelSheet.ActiveSheet.Range("A1:B6").Font.Size = 8

ExcelSheet.ActiveSheet.Range("B7:C13").Interior.Color = 10026745
ExcelSheet.ActiveSheet.Range("B7:C13").Borders.Weight = 2

ExcelSheet.ActiveSheet.Columns("A:C").EntireColumn.AutoFit

All help/advice is welcome!
 
I just did this to get the code:

1. Opened Excel
2. Did Tools / Macro / Record New Macro
3. Went up to Tools / Options
4. Unchecked the Gridlines checkbox in Excel
5. Stopped the Record Macro
6. Went to the IDE to check the code
7. Came out with this:
Code:
      ActiveWindow.DisplayGridlines = False

you should be able to make it work within Access, although you may need to tweak it slightly (I've found I have to explicitly name something sometimes as opposed to just using the "active..."
 
Also did the same process for the maximizing the window:

To maximize the sheet within the window:
Code:
ActiveWindow.WindowState = xlMaximized

To maximize the application:
Code:
Application.WindowState = xlMaximized
 
Thanks, it works! :D I had to change the lines a little bit and got the following code:

Code:
ExcelSheet.Application.WindowState = xlMaximized

ExcelSheet.Application.ActiveWindow.WindowState = xlMaximized
ExcelSheet.Application.ActiveWindow.DisplayGridlines = False
 

Users who are viewing this thread

Back
Top Bottom