Tuesday, June 12, 2007

VB Excel Programming

With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "Recap of Practice Charges To" & Chr(10) & "Research Charges" & Chr(10) & "By Payor" & Chr(10) & " " & strFromChrtDte & " Through " & strToChrtDte
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.19)
.BottomMargin = Application.InchesToPoints(0.05)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.01)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 5
End With

ActiveSheet.ResetAllPageBreaks
With Worksheets("INDIV")
.HPageBreaks.Add .Range("A35")
.HPageBreaks.Add .Range("A65")
.HPageBreaks.Add .Range("A94")
.HPageBreaks.Add .Range("A124")
End With


reset the pagebreak
ActiveWindow.View = xlPageBreakPreview

If you want to reset to none is case all over the place as you state try:
Cells.PageBreak = xlNone

Also look if you are using code if you have any of these code line that are kicking in:
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
ActiveWindow.SelectedSheets.VPageBreaks.Add Before:=ActiveCell


merge excel cells

mxlSheet.Range(mxlSheet.Cells(1, p), mxlSheet.Cells(1, i)).MergeCells = True
mxlSheet.Range(mxlSheet.Cells(1, p), mxlSheet.Cells(1, i)).HorizontalAlignment = xlCenter
mxlSheet.Range(mxlSheet.Cells(1, p), mxlSheet.Cells(1, i)).font.bold = True
mxlSheet.Range(mxlSheet.Cells(1, p), mxlSheet.Cells(1, i)) = Name

p and i are integers that I set above.


sample clause 2
Here's the zoom function
ActiveWindow.Zoom = 77

And the Horizontal Alignment. Keep in mind you will need to have a selection made or use a range statement with the HorizontalAlignment function like I'm showing here.

Range("C9:H9").HorizontalAlignment = xlCenterAcrossSelection


set the page property of Excel




in VB Sql "" problem

the seesights of the Manila

Japanese Excel programming in VB

No comments: