+ Reply to Thread
Results 1 to 5 of 5

Button to print non-active page - How?

  1. #1
    Registered User
    Join Date
    08-18-2006
    Posts
    43

    Button to print non-active page - How?

    Private Sub CommandButton1_Click()
    Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
    End Sub

    I did a search and tried to combine some results of what I found with bits and peices of what I have been learning. Can someone show me what I need to do here? Active wont work, because the page named "Print Data" that I want printed from my workbook is not active. And my experiment of inserting "Worksheets("Print Data")" in its place didn't work. So what should I use instead?

  2. #2
    Dan Hatola
    Guest

    RE: Button to print non-active page - How?

    The code you have just wsets the print area. It isn't actually telling the
    computer to print anything. Try the PrintOut method. You can see all of the
    details in the VBA help, but for the basics it should just be:

    Worksheets("Print Data").PrintOut

    Dan

    "Bafa" wrote:

    >
    > Private Sub CommandButton1_Click()
    > Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
    > End Sub
    >
    > I did a search and tried to combine some results of what I found with
    > bits and peices of what I have been learning. Can someone show me what
    > I need to do here? Active wont work, because the page named "Print
    > Data" that I want printed from my workbook is not active. And my
    > experiment of inserting "Worksheets("Print Data")" in its place didn't
    > work. So what should I use instead?
    >
    >
    > --
    > Bafa
    > ------------------------------------------------------------------------
    > Bafa's Profile: http://www.excelforum.com/member.php...o&userid=37748
    > View this thread: http://www.excelforum.com/showthread...hreadid=573626
    >
    >


  3. #3
    jb
    Guest

    Re: Button to print non-active page - How?

    You might try;

    Sub PRINT_DATA()
    Sheets("CHART_DATA").Select
    Range("A1:Q57").Select
    ActiveSheet.PageSetup.PrintArea = "$A$1:$S$57"
    dlgprintr = Application.Dialogs(xlDialogPrint).Show ' POPUP PRINT DIALOG
    BOX
    End Sub

    "Bafa" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Private Sub CommandButton1_Click()
    > Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
    > End Sub
    >
    > I did a search and tried to combine some results of what I found with
    > bits and peices of what I have been learning. Can someone show me what
    > I need to do here? Active wont work, because the page named "Print
    > Data" that I want printed from my workbook is not active. And my
    > experiment of inserting "Worksheets("Print Data")" in its place didn't
    > work. So what should I use instead?
    >
    >
    > --
    > Bafa
    > ------------------------------------------------------------------------
    > Bafa's Profile:
    > http://www.excelforum.com/member.php...o&userid=37748
    > View this thread: http://www.excelforum.com/showthread...hreadid=573626
    >




  4. #4
    Dave Peterson
    Guest

    Re: Button to print non-active page - How?

    Your code only changes the printarea. It doesn't actually print anything:

    Private Sub CommandButton1_Click()
    Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
    Worksheets("Print Data").Printout
    End Sub

    Bafa wrote:
    >
    > Private Sub CommandButton1_Click()
    > Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
    > End Sub
    >
    > I did a search and tried to combine some results of what I found with
    > bits and peices of what I have been learning. Can someone show me what
    > I need to do here? Active wont work, because the page named "Print
    > Data" that I want printed from my workbook is not active. And my
    > experiment of inserting "Worksheets("Print Data")" in its place didn't
    > work. So what should I use instead?
    >
    > --
    > Bafa
    > ------------------------------------------------------------------------
    > Bafa's Profile: http://www.excelforum.com/member.php...o&userid=37748
    > View this thread: http://www.excelforum.com/showthread...hreadid=573626


    --

    Dave Peterson

  5. #5
    Registered User
    Join Date
    08-18-2006
    Posts
    43
    Well I am glad to see I at least figured out half of the code. Thanks again.

+ 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