Prev: Thanks
Next: Web form fillup code not working
From: SammyL on 6 May 2010 12:46 Hi All, I am trying the following in vbscript... I keep having trouble with zoom and pagebreaks- what am I doing wrong- or what should i be doing? Dim xlapp Dim objWorkBook DIM XLWB Set xlapp = CreateObject("EXCEL.APPLICATION") Set objWorkBook = xlapp.Workbooks.Open("C:\test22.xls") Const xlLandScape = 2 xlapp.ActiveSheet.PageSetup.Orientation = xlLandScape xlapp.ActiveSheet.PageSetup.FitToPagesWide = 1 xlapp.ActiveSheet.PageSetup.FitToPagesTall = 99 xlapp.ActiveSheet.ResetAllPageBreaks 'xlapp.ActiveSheet.Zoom = False ActiveSheet.HPageBreaks(1).Location = Range("A25")
From: Tom Lavedas on 6 May 2010 13:23 On May 6, 12:46 pm, SammyL <sam...(a)gmail.com> wrote: > Hi All, > > I am trying the following in vbscript... I keep having trouble with > zoom and pagebreaks- what am I doing wrong- or what should i be doing? > > Dim xlapp > Dim objWorkBook > DIM XLWB > Set xlapp = CreateObject("EXCEL.APPLICATION") > Set objWorkBook = xlapp.Workbooks.Open("C:\test22.xls") > Const xlLandScape = 2 > xlapp.ActiveSheet.PageSetup.Orientation = xlLandScape > xlapp.ActiveSheet.PageSetup.FitToPagesWide = 1 > xlapp.ActiveSheet.PageSetup.FitToPagesTall = 99 > xlapp.ActiveSheet.ResetAllPageBreaks > 'xlapp.ActiveSheet.Zoom = False > ActiveSheet.HPageBreaks(1).Location = Range("A25") The Excel help documents the Zoom property as applying to the PageSetup object, so this should work ... xlapp.ActiveSheet.PageSetup.Zoom = False Also, in the last line, the ActiveSheet needs to be referenced to the xlapp object and the Range object must be referenced to a worksheet, something like this ... xlapp.ActiveSheet.HPageBreaks(1).Location = ActiveSheet.Range("A25") _____________________ Tom Lavedas
|
Pages: 1 Prev: Thanks Next: Web form fillup code not working |