View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Strange behavior with old macro now throws error with "Application

Please check whether there is any issue with your printer
--
If this post helps click Yes
---------------
Jacob Skaria


"owlnevada" wrote:

I've been using this same macro for years and all of a sudden after moving
some code around between modules, this code changed the appearance of the
word "Application" to "application" and throws error "Expected function or
variable". I removed all the Option Explicit's and no change.

Anybody have a clue as to what would cause this behavior?


Sub FixAbsPageSetupDefaultsNew() '(Optional control As IRibbonControl)
'ResetAbstractPrintArea
'
' ResetAbstractPrintArea Macro
' Clears Print Area then fixes all printer defaults to our standard
templates settings
'

Dim I As Integer
Dim Count As Integer
Dim sheetnames() As String
Dim ws As Worksheet

Count = 1

Call SelectAllAbstracts ' makes these selected sheets in the activeworkbook

application.ScreenUpdating = False 'here and also down below

For Each ws In ActiveWindow.SelectedSheets

With ws.PageSetup
.PrintArea = ""
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&""Arial,Regular""&8&F &A"
.CenterFooter = "&""Arial,Regular""&8Printed on &D" '
.RightFooter = ""
.LeftMargin = application.InchesToPoints(0.5)
.RightMargin = application.InchesToPoints(0.5)
.TopMargin = application.InchesToPoints(0.25)
.BottomMargin = application.InchesToPoints(0)
.HeaderMargin = application.InchesToPoints(0)
.FooterMargin = application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

Next ws
ActiveWindow.Zoom = 70
ActiveWindow.DisplayGridlines = False

Range("N2").Select

End Sub