ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel print area size (https://www.excelbanter.com/excel-programming/336913-excel-print-area-size.html)

tom

Excel print area size
 
Hello, i am creating an excell sheet by code with Visual Fox Pro. everything
is fine with one exception. i have set the print area to be a certain size,
but my data wcould be larger than that, so when it prints i get the last page
cut off.

is there a way to have the sheet or workbook print area shrink or grow
depending on the data?


Tom Ogilvy

Excel print area size
 
Don't set a print area. By default, excel prints all the data.

This can be a problem if Excel thinks you usedrange is larger than it
actually is - but if your are creating the sheet, this shouldn't be a
problem.

Otherwise

Activesheet.PageSetup.PrintArea =
ActiveSheet.UsedRange.Address(external:=True)

or if it is like a database

Activesheet.PageSetup.PrintArea = _
ActiveSheet.Range("A1").CurrentRegion.Address(exte rnal:=True)

--
Regards,
Tom Ogilvy


"Tom" wrote in message
...
Hello, i am creating an excell sheet by code with Visual Fox Pro.

everything
is fine with one exception. i have set the print area to be a certain

size,
but my data wcould be larger than that, so when it prints i get the last

page
cut off.

is there a way to have the sheet or workbook print area shrink or grow
depending on the data?




tom

Excel print area size
 
Tom, i removed my line that stated the print area, However i have some other
business that is happening on the sheet also, i am using cells to hold
formula results and then are showing them in the printed sheet.

when i set the print area these cells did not show or print, now they do.

i am a little confused as to my options with this. that is why i set the
print area before, to stop these from printing,

"Tom Ogilvy" wrote:

Don't set a print area. By default, excel prints all the data.

This can be a problem if Excel thinks you usedrange is larger than it
actually is - but if your are creating the sheet, this shouldn't be a
problem.

Otherwise

Activesheet.PageSetup.PrintArea =
ActiveSheet.UsedRange.Address(external:=True)

or if it is like a database

Activesheet.PageSetup.PrintArea = _
ActiveSheet.Range("A1").CurrentRegion.Address(exte rnal:=True)

--
Regards,
Tom Ogilvy


"Tom" wrote in message
...
Hello, i am creating an excell sheet by code with Visual Fox Pro.

everything
is fine with one exception. i have set the print area to be a certain

size,
but my data wcould be larger than that, so when it prints i get the last

page
cut off.

is there a way to have the sheet or workbook print area shrink or grow
depending on the data?





Tom Ogilvy

Excel print area size
 
You will have to identify what area you want printed and set that as the
print area rather than using a fixed range. (As I said, if you don't specify
it it prints the usedrange - so if you have cells that are used and you
don't want them printed then you have to identify what you do want printed).
Only you can tell how to identify the appropriate area. If you have a
database style layout and it is separate from data you don't want printed by
at least one blank row and one blank column, then you can use the
currentregion property of any cell within the data you want printed.

--
Regards,
Tom Ogilvy


"Tom" wrote in message
...
Tom, i removed my line that stated the print area, However i have some

other
business that is happening on the sheet also, i am using cells to hold
formula results and then are showing them in the printed sheet.

when i set the print area these cells did not show or print, now they do.

i am a little confused as to my options with this. that is why i set the
print area before, to stop these from printing,

"Tom Ogilvy" wrote:

Don't set a print area. By default, excel prints all the data.

This can be a problem if Excel thinks you usedrange is larger than it
actually is - but if your are creating the sheet, this shouldn't be a
problem.

Otherwise

Activesheet.PageSetup.PrintArea =
ActiveSheet.UsedRange.Address(external:=True)

or if it is like a database

Activesheet.PageSetup.PrintArea = _
ActiveSheet.Range("A1").CurrentRegion.Address(exte rnal:=True)

--
Regards,
Tom Ogilvy


"Tom" wrote in message
...
Hello, i am creating an excell sheet by code with Visual Fox Pro.

everything
is fine with one exception. i have set the print area to be a certain

size,
but my data wcould be larger than that, so when it prints i get the

last
page
cut off.

is there a way to have the sheet or workbook print area shrink or grow
depending on the data?







Tom Ogilvy

Excel print area size
 
Just some added,
you could hide rows and columns you don't want printed and then print
without specifying a printarea.

--
Regards,
Tom Ogilvy


"Tom" wrote in message
...
Tom, i removed my line that stated the print area, However i have some

other
business that is happening on the sheet also, i am using cells to hold
formula results and then are showing them in the printed sheet.

when i set the print area these cells did not show or print, now they do.

i am a little confused as to my options with this. that is why i set the
print area before, to stop these from printing,

"Tom Ogilvy" wrote:

Don't set a print area. By default, excel prints all the data.

This can be a problem if Excel thinks you usedrange is larger than it
actually is - but if your are creating the sheet, this shouldn't be a
problem.

Otherwise

Activesheet.PageSetup.PrintArea =
ActiveSheet.UsedRange.Address(external:=True)

or if it is like a database

Activesheet.PageSetup.PrintArea = _
ActiveSheet.Range("A1").CurrentRegion.Address(exte rnal:=True)

--
Regards,
Tom Ogilvy


"Tom" wrote in message
...
Hello, i am creating an excell sheet by code with Visual Fox Pro.

everything
is fine with one exception. i have set the print area to be a certain

size,
but my data wcould be larger than that, so when it prints i get the

last
page
cut off.

is there a way to have the sheet or workbook print area shrink or grow
depending on the data?







tom

Excel print area size
 
Tom, in my Code, i am Hiding the Cells i dont want the user to see when the
open up the sheet.

that Column does have a Space or empty row from the main body of the sheet.

if i set the print area osheet.pagesetup.printarea = "$A$1:I$166" then i
will print out all i need with EXCEPTIONS.
1) if after i create the Data using VFP and paste it into the sheet and it
runs past "
i166" it will not print out anything under that.

90% of the time that set printarea will work.

if i remove the printarea, even though i have hidden cells, they still
printout (one column of data on the last set of pages).

i am having a problem understanding the currentregion and usedrange props
and how i will use them in VFP without a good reference.

i dont mean to act stupid, i have just hit the WALL

Tom



All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com