Jump to content

How do I auto-set View Gridlines?


Recommended Posts

I have a couple of autoit routines that merge several Excel spreadsheets into one. One of the routines does not show the gridlines in the View mode. (Gridlines show when printed.) The original spreadsheets -- which are output from a database application -- also do not have 'View Gridlines' selected. How do I get the final merged spreadsheets to auto-set this feature? I have tried:

$oExcel.ActiveSheet.DisplayGridlines=True

and

$oExcel.ActiveSheet.PrintGridlines=True

and

$oExcel.ActiveSheet.ViewGridlines=True

but no luck so far.

Any help would be greatly appreciated.

Thank you

Link to comment
Share on other sites

DisplayGridlines is a property of the Window object not the Worksheet object.

https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.window.displaygridlines.aspx

A simple search of the forum would have provided numerous examples; like the one below:

 

 

Edited by TheXman
Link to comment
Share on other sites

Yes, I have done several searches. I found the result you refer to and it was the closest I could find to what I'm trying to do; I was hoping I could apply the same command to a worksheet. I'll try again and specify worksheet in the search. Maybe that will help.

Link to comment
Share on other sites

6 minutes ago, Becca said:

I was hoping I could apply the same command to a worksheet.

Let me save you some time.  Like I said in my previous post, the DisplayGridlines property is a property of the Excel Window object.  That property does not exist for the Excel Worksheet object.  If you looked at the post that I linked to, you will see one way to do exactly what it is you are trying to do, which is to enable/disable the displaying of gridlines.

Link to comment
Share on other sites

NB.: Everything you can do manually in Excel, can be recorded with the macro recorder and then easily be translated to AutoIt.

http://www.contextures.com/excel-macro-record-test.html

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...