• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 635
  • Last Modified:

How do you set a print area for Excel 2007 using VIsual FoxPro?

I can do it using Excel 2003 but I can't define a print area using .PageSetup.PrintArea (it doesn't even show up under ActiveSheet.  Any thoughts?
0
djma
Asked:
djma
1 Solution
 
CaptainCyrilCommented:
I recorded a macro in Excel 2007.

Range("A1:J12").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$J$12"

Let's say you have oSheet as the object reference to the sheet.
oSheet.PageSetup.PrintArea = "$A$1:$J$12"

When I program automation, I try not to use ActiveWorkbook or ActiveSheet since they might lose reference.
0
 
djmaAuthor Commented:
It's funny.  I tried what I thought was every permutation but somehow missed.  Regardless, I have it working so thanks!
Doug.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now