LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Printing Setup help

Hi Everyone

I used the Macro Recorder to setup a quick-print.

Fairly straight-forward requirement.

1. Set the range of the sheet that has data.
2. Set the PrintArea (Including Orientation & Margins defined)
3. Insert Centre Header (including the Date as formatted)
4. Print Preview

Sub PrintHDC()

Dim SS As Worksheet
Dim Rng As Range
Dim myDate As Date

Set SS = Sheets("HDC")
Set Rng = SS.Range("A1:L" & Rows.Count) ' Select only the the range that
has data as it will vary everyday

myDate = Format(D, "Ddd, dd-Mmm-yy") ' to be included in the Page Header

With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With

ActiveSheet.PageSetup.PrintArea= (" ") ' This is the bit where it hangs
as I don't know what to insert here to define the variable print area
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&16HDC - &myDate" ' And this is the other problem,
how to incorporate the "Page Header Title" &" - "& myDate as it does not
auto-recognise it from the Dim Statement as it says its a (Type Mis-Match)
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.33)
.RightMargin = Application.InchesToPoints(0.12)
.TopMargin = Application.InchesToPoints(0.49)
.BottomMargin = Application.InchesToPoints(0.21)
.HeaderMargin = Application.InchesToPoints(0.16)
.FooterMargin = Application.InchesToPoints(0.12)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
ActiveWindow.SelectedSheets.PrintPreview
End Sub


TIA
Mick


 
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
printing setup issue in 2007 Zhi Sheng Excel Discussion (Misc queries) 1 November 8th 09 11:00 PM
Printing - Setup Natarajan Setting up and Configuration of Excel 2 October 25th 07 11:49 AM
Page Setup Printing Sharon Excel Discussion (Misc queries) 0 December 6th 06 02:55 PM
can VBA be used to set page setup for printing? Dave F Excel Discussion (Misc queries) 2 November 21st 06 06:27 PM
setup for userform printing Jacob Excel Programming 6 September 23rd 06 01:00 AM


All times are GMT +1. The time now is 06:57 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"