Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question in excel Automation

Status
Not open for further replies.

titoneon

MIS
Dec 11, 2009
335
US
Hi Everyone
I am using vfp 9.0. sp2 and i did an excel automation to printing the data from excel, but i would like to print the Gridlines in my output file, w/o selecting manually from the excel menu.

i just added this for footer and headers, but don't know how to define for printing the gridlines, from the vfp, can anyone tell me the line code i need.


.CenterHeader = m.lcJobNos+' |As of '+Dmy(Date())
.CenterFooter = "&G"
.RightFooter = "Page &P of &N"

Thanks in advance
 
Oops. Just noticed you want to print the gridlines. In that case, same principle as before, but you use [tt].PageSetup.DisplayGridLines[/tt] - just as you are doing with [tt]CenterHeader[/tt], etc.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Sorry. I seem to be having a bad afternoon (probably because it's late on Friday).

It's not [tt]DisplayGridLines[/tt]. It's [tt]PrintGridLines[/tt].

So, just to be clear, this is a property of the PageSetup object, which is in turn a property of the worksheet. Thus:

[tt]loMyWorkbookObject.Sheets("sheet1").PageSetup.PrintGridLines = .T.[/tt]

I think I've got it right this time.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

Here is code i have, but it does not work for me the line
.PageSetup.DisplayGridLines = .T. && what i did wrong ?

Code:
Local loExcel As excel.Application, lcFile
    loExcel = Createobject('excel.application')
    lcFile = "c:\qjob\"+._Filename+'.xls'
    
 With loExcel
    .Workbooks.Open(m.lcFile)     
    * Insert logo 
    .ActiveSheet.PageSetup.CenterFooterPicture.Filename = "C:\qjob\apexlogo.jpg"

    With .ActiveSheet.PageSetup
       .PageSetup.DisplayGridLines = .T. 
        .CenterHeader = m.lcJobNos+' |As of '+Dmy(Date()) 
        .CenterFooter = "&G"
        .RightFooter = "Page &P of &N"
    Endwith

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top