View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Carlos Lozano Carlos Lozano is offline
external usenet poster
 
Posts: 18
Default Pagebreaks problems - Urgent

Hi Jim,

Thank you for your feedback.

It would have been neat if I could replace several lines of code with only
one.
Unfortunately oSheet.Copy copies the whole oSheet object including any code.
The oSheet object has code that depends on a class defined in the current
workbook (the application). That class won't be in the new workbook, so it
fails on activation.

I found the problem for the mismatch of the pagebreaks. The original sheet
has a row size of 15.75, when assigned to the new exported sheet it takes
only the integer part, changing the location of the pagebreaks.

I was doing the following:
nHeight = oSheet.Cells(nMinRow, 1).RowHeight
..
..
Set oExpSheet = ActiveWorkbook.Sheets("Design Project")
oExpSheet.Select
Columns("A:V").Select
oExpSheet.Paste
oExpSheet.Range("A1", "A800").RowHeight = nHeight
oExpSheet.Range("A7").RowHeight = 21
..
..
The value in nHeight is the row height = 15.75, but when assigned to the range
on oExpSheet it truncates it to only 15.

I also tried the below direct assignment.
oExpSheet.Range("A1", "A800").RowHeight = oSheet.Cells(nMinRow, 1).RowHeight

The only way it works is by hard-coding the row height directly as:
oExpSheet.Range("A1", "A800").RowHeight = 15.75

This will give problems if the user changes the row size.

Thank you,

Carlos Lozano

"Jim Cone" wrote:

Carlos,

Instead of copying and pasting the range, why not
just copy the entire sheet as is, and not worry about
the formatting...

oSheet.Copy Befo=Workbooks(NewWorkBook).Worksheets(1)

Regards,
Jim Cone
San Francisco, USA


"Carlos Lozano" wrote in
message ...
Hi,

I have an Excel application that creates a visual design using images. As an
overview the application paste images into the design sheet moving down any
existings images. I find out where the next pagebreak will be to locate the
image before or after a pagebreak to avoid splitting the image in the preview
or when printing.
When the "design" is finished it is exported to another workbook (Saved as).
All the pageSetup settings are set on the new workbook's sheet that will hold
the design on.
In the exporting application everything works find, it finds the pagebreaks
and locate the images just right. The preview or printing never splits any
images.

The problem:
The exported sheet has different pagebreaks even they have same pageSetup
properties. This means if a design is larger than one page, the images are
splitted or wrongly located.

You can find the code of the exportDesign sub below.

I will appreciate any ideas.

Carlos

-snip-