Print Routine Error

N

Nancy X

Hi Group;

I copied this from one of the other users in the users group, However I get
an error near the bottom of the code!

We are currently using Excel 2002

With ws.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = "$A:$D"
.LeftHeader = ""
.CenterHeader = "&" "Arial,Bold" "Errors in Student File Report"
.RightHeader = ""
.LeftFooter = "&8&D"
.CenterFooter = ""
.RightFooter = "&8&T"
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed '! Error on this Line
End With
' ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveWindow.SelectedSheets.PrintPreview

Does anyone know why I am getting the error on the above line?
Also are all these lines necessary?

Thank You Group
Nancy X.
 
D

Don Guillett

Could be that you have a version before xl2002. Remove line along with any
others NOT necessary to what you are doing as pagesetup really slows down
macros. Best to use a template worksheet instead.
 
T

Tom Ogilvy

You version of Excel probably doesn't support that command. Just remove that
line.
 
N

Nancy X

Don;
Thanks for getting back to me!

It is a retail copy of Excel 2002. The regional education center had
a serious problem with Vista so we reverted back for a while!

This is the first time in my life I have ever use Excel, so to say I
am green is an understatement.

Is there someplace you can direct me to see a template worksheet?

Thanks Again

Nancy X.
 
L

Len

Nancy;
I am not a real good Excel Macro programmer, but I am in Education
20 hours a week and the military base attached to our school district the
remaining time.

You are going to have to filter the data twice!

The first time just the ActiveSheet.

If you need to display the blank Column(I do not know why you would?) make
sure your columns fit.

There are two methods: The one I like is shown below because for some
reason Autofit does not always execute!

With ws.Range("A:?").EntireColumn
.ColumnWidth = 85
.AutoFit
End With

? is your last column + 1.

The reason for the 85 is that it will put 85 spaces in your column and print
that way.

The print part is very easy!

ActiveSheet.PrintPreview

When the print layout shows you can print it or close it.

Now you have to perform your filter again (There is an instruction on how to
reset it, but I cannot remember the exact script)

Apply your new filter, move your data from your activesheet to your new
sheet and then save it as you requested in Saturday's request.

If you are going to display your data again, repeat the Autofit code again.

Hope I am not messing you up!

Good Luck and happy class scheduling? I am guessing that is what you are
trying to do!

Len
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top