+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    08-23-2008
    Location
    Midlothian
    Posts
    2

    Question Printing Macro-series of check boxes

    I have an excel file with 7 sheets. The first is to receive input values. 2-6 produce printable form letters and 7 has behind the scenes equations and tables.

    On sheet one I have a series of check boxes that prompt the user to select which sheets they want printed (sometimes it will be just one, sometimes multiple sheets). These check boxes correspond to TRUE/FALSE values on the last sheet. On sheets 2-6 in cell A1, each has an equation similar to this:
    =IF('data_sheet'!A100=TRUE," ",""). This puts a "value" in cell A1. I have a the following macro on the input sheet:

    Sub CommandButton1_Click()
    Dim Sh As Worksheet
    Dim Arr() As String
    Dim N As Integer
    N = 0
    For Each Sh In ActiveWorkbook.Worksheets
    If Sh.Visible = xlSheetVisible And Sh.Range("A1").Value <> "" Then
    N = N + 1
    ReDim Preserve Arr(1 To N)
    Arr(N) = Sh.Name
    End If
    Next
    With ActiveWorkbook
    .Worksheets(Arr).PrintOut
    End With
    End Sub


    This works fine and prints my selected sheets. We have a program called CutePDF Writer that is setup on system as a printer. When you select this printer, it converts the file into a PDF.
    My question is this:
    How do I modify the above code to print my selected sheets to "CutePDF Writer on CPW2"?

    I have tinkered with the Application.ActivePrinter function with no luck.

    disclaimer... I know how to program in C++ but don't know visual basic or understand its syntax, so you need to be specific with your response.

    Thanks in advance

  2. #2
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,131
    Please read the Forum Rules and then edit your post to wrap your code with Code Tags.

  3. #3
    Registered User
    Join Date
    08-23-2008
    Location
    Midlothian
    Posts
    2
    I have an excel file with 7 sheets. The first is to receive input values. 2-6 produce printable form letters and 7 has behind the scenes equations and tables.

    On sheet one I have a series of check boxes that prompt the user to select which sheets they want printed (sometimes it will be just one, sometimes multiple sheets). These check boxes correspond to TRUE/FALSE values on the last sheet. On sheets 2-6 in cell A1, each has an equation similar to this:
    Code:
    =IF('data_sheet'!A100=TRUE," ","")
    . This puts a "value" in cell A1. I have a the following macro on the input sheet:

    Code:
    Sub CommandButton1_Click()
    Dim Sh As Worksheet
    Dim Arr() As String
    Dim N As Integer
    N = 0
    For Each Sh In ActiveWorkbook.Worksheets
    If Sh.Visible = xlSheetVisible And Sh.Range("A1").Value <> "" Then
    N = N + 1
    ReDim Preserve Arr(1 To N)
    Arr(N) = Sh.Name
    End If
    Next
    With ActiveWorkbook
    .Worksheets(Arr).PrintOut
    End With
    End Sub

    This works fine and prints my selected sheets. We have a program called CutePDF Writer that is setup on system as a printer. When you select this printer, it converts the file into a PDF.
    My question is this:
    How do I modify the above code to print my selected sheets to "CutePDF Writer on CPW2"?

    I have tinkered with the Application.ActivePrinter function with no luck.

    disclaimer... I know how to program in C++ but don't know visual basic or understand its syntax, so you need to be specific with your response.

    Thanks in advance
    Last edited by calitopgun; 08-23-2008 at 10:27 PM. Reason: asked to by moderator

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Run macro in workbook B from a macro in Workbook A
    By Wizz in forum Excel Programming
    Replies: 3
    Last Post: 05-28-2008, 09:41 AM
  2. Printing selected items as a form - editing the macro
    By myoldself in forum Excel Programming
    Replies: 6
    Last Post: 12-17-2007, 02:13 AM
  3. Read-only error using Form Button with Assign Macro
    By samf88 in forum Excel Programming
    Replies: 3
    Last Post: 11-09-2007, 02:15 PM
  4. country finder lookup macro
    By theghost in forum Excel Programming
    Replies: 0
    Last Post: 05-07-2007, 11:41 PM
  5. Printing Macro-piece of code
    By eddie barzoon in forum Excel Programming
    Replies: 4
    Last Post: 04-25-2007, 07:41 PM

Tags for this Thread

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.2.0