Excel header/footer fonts and automation  
Author Message
ChancreSore02





PostPosted: Visual FoxPro General, Excel header/footer fonts and automation Top

Hi, I did a search but didn't see this topic brought up.

I want to change the font of my header in Excel (ver 11) using Visual Foxpro (ver 9). I used the macro recorder in excel to get a general idea, but I can't seem to get the code to work in VFP.

Here's the excel code:

ActiveSheet.PageSetup.LeftHeader = "&""Arial,Regular""2nd QTR 2006 vs 2nd QTR 2005"


How do I get that code to work in Fox

Any help would be much appreciated!

Jeff


Visual FoxPro1  
 
 
AnnyJacky





PostPosted: Visual FoxPro General, Excel header/footer fonts and automation Top

XLApp = tmpsheet.Application

XLApp.WorkBooks.Add()

xlsheet = XLApp.ActiveSheet

xlsheet.PageSetup.LeftFooter = "-Footer here--"


 
 
ChancreSore02





PostPosted: Visual FoxPro General, Excel header/footer fonts and automation Top

Right, I got that part. I'm just not sure how to change the font.

 
 
Alex Feldstein





PostPosted: Visual FoxPro General, Excel header/footer fonts and automation Top

>Here's the excel code:
>ActiveSheet.PageSetup.LeftHeader = "&""Arial,Regular""2nd QTR 2006 vs 2nd QTR 2005"
>How do I get that code to work in Fox

 

Try:

ActiveSheet.PageSetup.LeftHeader = [&"Arial,Regular"2nd QTR 2006 vs 2nd QTR 2005]

 


 
 
ChancreSore02





PostPosted: Visual FoxPro General, Excel header/footer fonts and automation Top

>Here's the excel code:
>ActiveSheet.PageSetup.LeftHeader = "&""Arial,Regular""2nd QTR 2006 vs 2nd QTR 2005"
>How do I get that code to work in Fox

Try:

ActiveSheet.PageSetup.LeftHeader = [&"Arial,Regular"2nd QTR 2006 vs 2nd QTR 2005]



Excellent, that worked! However, I'm not sure how you make that work with a variable as opposed to actual text. That is: ActiveSheet.PageSetup.LeftHeader = [&"Arial,Regular"lcLeftHeader]

That puts "lcLeftHeader" in the header, as opposed to the value I assigned to it.

Any suggestions

Thanks,

Jeff



 
 
CetinBasoz





PostPosted: Visual FoxPro General, Excel header/footer fonts and automation Top

ActiveSheet.PageSetup.LeftHeader = [&"Arial,Regular"]+m.lcLeftHeader


 
 
ChancreSore02





PostPosted: Visual FoxPro General, Excel header/footer fonts and automation Top

That worked perfect, thanks!