Windows Vista Forums

excel syntax

  1. #1


    SammyL Guest

    excel syntax

    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")

      My System SpecsSystem Spec

  2. #2


    Tom Lavedas Guest

    Re: excel syntax

    On May 6, 12:46*pm, SammyL <sam...@newsgroup> 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

      My System SpecsSystem Spec

excel syntax

Similar Threads
Thread Thread Starter Forum Replies Last Post
Generic Interface syntax in VS 2005 using Old syntax Saad .NET General 1 09 Jun 2009
create Excel spreadsheet without loading Excel sneaky hamster VB Script 2 21 Oct 2008
How to view Excel document without Microsoft Office Excel installe jl Vista General 8 20 Apr 2008
Vista ASP.NET 2.0 Cannot open Excel File using Microsoft.Excel 12.0 COM object ckellywilson Microsoft Office 0 26 Mar 2008
"invalid STORE command syntax invalid message set syntax" Catullus Nacakus Vista mail 6 26 Jan 2008