Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Set print area problem

Trying to automate setting the print area on a sheet I use as a template and
am having problems.

The section of code is:

Set myprint = Range(mytop, mybot)
myprint.Select
ActiveSheet.PageSetup.PrintArea = myprint

While the required area is selected on screen OK, the last line gives me a
Run-time error '1004: Unable to set the PrintArea property of the PageSetup
class.

Have tried some alternatives but I'm stumped.

Any help would be appreciated

Regards
Philip


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Set print area problem

Hi Philip,

Try:

ActiveSheet.PageSetup.PrintArea = myprint.Address



---
Regards,
Norman



"Philip Reece-Heal" wrote in message
...
Trying to automate setting the print area on a sheet I use as a template
and am having problems.

The section of code is:

Set myprint = Range(mytop, mybot)
myprint.Select
ActiveSheet.PageSetup.PrintArea = myprint

While the required area is selected on screen OK, the last line gives me a
Run-time error '1004: Unable to set the PrintArea property of the
PageSetup class.

Have tried some alternatives but I'm stumped.

Any help would be appreciated

Regards
Philip




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Set print area problem

How are your variables declared? If myprint is a range, try:
ActiveSheet.PageSetup.PrintArea = Range(myprint)


Mike F

"Philip Reece-Heal" wrote in message
...
Trying to automate setting the print area on a sheet I use as a template
and am having problems.

The section of code is:

Set myprint = Range(mytop, mybot)
myprint.Select
ActiveSheet.PageSetup.PrintArea = myprint

While the required area is selected on screen OK, the last line gives me a
Run-time error '1004: Unable to set the PrintArea property of the
PageSetup class.

Have tried some alternatives but I'm stumped.

Any help would be appreciated

Regards
Philip




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Set print area problem

Hi Mike,

How are your variables declared? If myprint is a range, try:
ActiveSheet.PageSetup.PrintArea = Range(myprint)


If myprint is a range, then the expression Range(myprint) would generate an
error.

Additionally, the PrintArea property requires an address string.

---
Regards,
Norman




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Set print area problem

You are right, my mistake. I opened my mouth without testing it first.
"Norman Jones" wrote in message
...
Hi Mike,

How are your variables declared? If myprint is a range, try:
ActiveSheet.PageSetup.PrintArea = Range(myprint)


If myprint is a range, then the expression Range(myprint) would generate
an error.

Additionally, the PrintArea property requires an address string.

---
Regards,
Norman








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Set print area problem


Thanks Norman

You are a star

It worked a treat

Regards
Philip


*** Sent via Developersdex http://www.developersdex.com ***
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Set print area problem

Thanks to you both, that's cracked my problem.

Regards
Philip
"Philip Reece-Heal" wrote in message
...
Trying to automate setting the print area on a sheet I use as a template
and am having problems.

The section of code is:

Set myprint = Range(mytop, mybot)
myprint.Select
ActiveSheet.PageSetup.PrintArea = myprint

While the required area is selected on screen OK, the last line gives me a
Run-time error '1004: Unable to set the PrintArea property of the
PageSetup class.

Have tried some alternatives but I'm stumped.

Any help would be appreciated

Regards
Philip




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
set area in excel not giving me option to set print area? J Littlebear Excel Discussion (Misc queries) 4 April 23rd 23 09:04 PM
File, print area, clear area, is not working cblind New Users to Excel 2 September 12th 07 04:51 PM
Macro - Set Print Area for Changing Data Area ksp Excel Programming 5 May 15th 06 10:20 PM
How do you turn off a print area for a page? (no print area) Grunen Excel Discussion (Misc queries) 4 October 8th 05 07:46 PM
In Excel print area setup problem with 2 different computers with. Rafi Setting up and Configuration of Excel 1 December 22nd 04 10:44 AM


All times are GMT +1. The time now is 11:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"