+ Reply to Thread
Results 1 to 5 of 5

Printing a Pivot Table from code - Excel 2003

  1. #1
    Newbie
    Guest

    Printing a Pivot Table from code - Excel 2003

    Hi,

    I have a pivot table that constantly changes based on what the user chooses
    to analyse.

    I want the user to be able to print the pivot table at the click of a button
    with having to keep setting the print area.

    Is there a way to do this programmatically

    If yes, how?

    Thanks



  2. #2
    Debra Dalgleish
    Guest

    Re: Printing a Pivot Table from code - Excel 2003

    You shouldn't have to set a print area. If the pivot table is the only
    thing on the worksheet, only the pivot table range will print.

    Newbie wrote:
    > Hi,
    >
    > I have a pivot table that constantly changes based on what the user chooses
    > to analyse.
    >
    > I want the user to be able to print the pivot table at the click of a button
    > with having to keep setting the print area.
    >
    > Is there a way to do this programmatically
    >
    > If yes, how?
    >
    > Thanks
    >
    >



    --
    Debra Dalgleish
    Excel FAQ, Tips & Book List
    http://www.contextures.com/tiptech.html


  3. #3
    Newbie
    Guest

    Re: Printing a Pivot Table from code - Excel 2003

    Thanks but there are other things on the worksheet . . . . any other ideas?
    "Debra Dalgleish" <[email protected]> wrote in message
    news:[email protected]...
    > You shouldn't have to set a print area. If the pivot table is the only
    > thing on the worksheet, only the pivot table range will print.
    >
    > Newbie wrote:
    >> Hi,
    >>
    >> I have a pivot table that constantly changes based on what the user
    >> chooses to analyse.
    >>
    >> I want the user to be able to print the pivot table at the click of a
    >> button with having to keep setting the print area.
    >>
    >> Is there a way to do this programmatically
    >>
    >> If yes, how?
    >>
    >> Thanks

    >
    >
    > --
    > Debra Dalgleish
    > Excel FAQ, Tips & Book List
    > http://www.contextures.com/tiptech.html
    >




  4. #4
    Debra Dalgleish
    Guest

    Re: Printing a Pivot Table from code - Excel 2003

    You could use the TableRange2 property to create an address for the
    print area. For example:

    '==============================
    Dim ws As Worksheet
    Dim rngPT As Range
    Dim strPT As String

    Set ws = ActiveSheet
    Set rngPT = ws.PivotTables(1).TableRange2
    strPT = rngPT.Address

    ws.PageSetup.PrintArea = strPT
    '=====================

    Newbie wrote:
    > Thanks but there are other things on the worksheet . . . . any other ideas?
    > "Debra Dalgleish" <[email protected]> wrote in message
    > news:[email protected]...
    >
    >>You shouldn't have to set a print area. If the pivot table is the only
    >>thing on the worksheet, only the pivot table range will print.
    >>
    >>Newbie wrote:
    >>
    >>>Hi,
    >>>
    >>>I have a pivot table that constantly changes based on what the user
    >>>chooses to analyse.
    >>>
    >>>I want the user to be able to print the pivot table at the click of a
    >>>button with having to keep setting the print area.
    >>>
    >>>Is there a way to do this programmatically
    >>>
    >>>If yes, how?
    >>>
    >>>Thanks

    >>
    >>
    >>--
    >>Debra Dalgleish
    >>Excel FAQ, Tips & Book List
    >>http://www.contextures.com/tiptech.html
    >>

    >
    >
    >



    --
    Debra Dalgleish
    Excel FAQ, Tips & Book List
    http://www.contextures.com/tiptech.html


  5. #5
    Newbie
    Guest

    Re: Printing a Pivot Table from code - Excel 2003

    Thanks I'll give it a go
    "Debra Dalgleish" <[email protected]> wrote in message
    news:[email protected]...
    > You could use the TableRange2 property to create an address for the
    > print area. For example:
    >
    > '==============================
    > Dim ws As Worksheet
    > Dim rngPT As Range
    > Dim strPT As String
    >
    > Set ws = ActiveSheet
    > Set rngPT = ws.PivotTables(1).TableRange2
    > strPT = rngPT.Address
    >
    > ws.PageSetup.PrintArea = strPT
    > '=====================
    >
    > Newbie wrote:
    > > Thanks but there are other things on the worksheet . . . . any other

    ideas?
    > > "Debra Dalgleish" <[email protected]> wrote in message
    > > news:[email protected]...
    > >
    > >>You shouldn't have to set a print area. If the pivot table is the only
    > >>thing on the worksheet, only the pivot table range will print.
    > >>
    > >>Newbie wrote:
    > >>
    > >>>Hi,
    > >>>
    > >>>I have a pivot table that constantly changes based on what the user
    > >>>chooses to analyse.
    > >>>
    > >>>I want the user to be able to print the pivot table at the click of a
    > >>>button with having to keep setting the print area.
    > >>>
    > >>>Is there a way to do this programmatically
    > >>>
    > >>>If yes, how?
    > >>>
    > >>>Thanks
    > >>
    > >>
    > >>--
    > >>Debra Dalgleish
    > >>Excel FAQ, Tips & Book List
    > >>http://www.contextures.com/tiptech.html
    > >>

    > >
    > >
    > >

    >
    >
    > --
    > Debra Dalgleish
    > Excel FAQ, Tips & Book List
    > http://www.contextures.com/tiptech.html
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1