Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts

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

Wednesday, May 30, 2007

Method 'Cells' of object '_Global' failed

Method 'Cells' of object '_Global' failed is the error i encounted in the Program of Generate the Excel report Using VB.

When i encounted this problem , i don't know wat happened to it ,because it is my first time to use the Excel application to generate a report . And i search the error message in the google, then i got the answer , it help me to understand the procedure of the excel generating .www.pcreview.co.uk/ here shows out the reason why it occurs the error. Hope it will be help to the ones who encounted it . Good luck!