Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I think I already know the answer to this ("NO!") but I thought I would reach out and hope that someone can prove me wrong.

I have a lot (tens of thousands) of Excel spreadsheets that I will be imaging (printing to TIFF) for a client. They have just added a new wrinkle to request the gridlines and the column headers on the resultant TIFFs.

Is there a way to force this from the registry? Or would it require opening each document and checking the correct boxes?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

i do not know of any registry settings for this, but i imagine if all the documents to be printed were in a single folder it would not be too hard to handle with a macro. working example below.

Sub GridsHeaders()
    Dim FSO As Object
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Dim FLS As Object, F As Object
    Dim fWB As Workbook, fSheet As Worksheet
    Dim Loc As String

    With Application.FileDialog(msoFileDialogFolderPicker)
        .Title = "Select Folder"
        .AllowMultiSelect = False
        If .Show <> -1 Then Exit Sub
        Loc = .SelectedItems(1)
    End With

    Set FLS = FSO.GetFolder(Loc).Files
    For Each F In FLS
        Loc = UCase(Mid(F.Name, InStrRev(F.Name, ".") + 1))
        If Loc = "XLS" Or Loc = "XLSX" Then
            Set fWB = Workbooks.Open(F.Path)
            For Each fSheet In fWB.Sheets
                fSheet.PageSetup.PrintGridlines = True
                fSheet.PageSetup.PrintHeadings = True
            Next fSheet
            fWB.Close True
        End If
    Next F
End Sub
share|improve this answer
    
Sadly, they are not -- these documents are being imaged for legal review, and our current process does not lend itself to moving classes of document types around the file system willy-nilly. –  dreynold Nov 11 '10 at 19:24
    
i added a working example of what the macro would look like to my answer, in case it might help you. although you can not consolidate the files for a single run, it may still help if you do have more then one file per folder in places. –  Xantec Nov 11 '10 at 19:47
    
Thanks for that! It gave me the crucial bit (foo.PageSetup.PrintGridlines = True) I needed to implement this in python. –  dreynold Nov 17 '10 at 19:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.