• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 642
  • 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?
1 Solution
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
I recorded a macro in Excel 2007.

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.
djmaAuthor Commented:
It's funny.  I tried what I thought was every permutation but somehow missed.  Regardless, I have it working so thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

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