Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jul 2003
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel print script (Excel XP)

    Hi,

    I have the following code in my Excel Workbook. It prints al worksheets except the one named "Berekening". Now i want to add some more worksheets to the exception. How can I add this in the following code?

    Dim strSheetNames As String
    Dim intC As Integer
    With ActiveWorkbook
    For intC = 1 To .Worksheets.Count
    If .Worksheets(intC).Name <> "Berekening" Then _
    strSheetNames = strSheetNames & .Worksheets(intC).Name & ", "
    Next intC
    strSheetNames = Left(strSheetNames, Len(strSheetNames) - 2)
    Worksheets(Split(strSheetNames, ", ")).PrintOut _
    Copies:=1, ActivePrinter:="server01HPLJ4100", Collate:=True
    End With
    End Sub

    Tnx
    Gerben

  2. #2
    Star Lounger
    Join Date
    Sep 2003
    Location
    Betekom, Belgium
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel print script (Excel XP)

    Hi dag Gerben,

    You can add
    If .Worksheets(intC).Name <> "Berekening" or .Worksheets(intC).Name >< " whatever other sheetname" Then _
    strSheetNames = strSheetNames & .Worksheets(intC).Name & ", "

    to get your result

  3. #3
    Lounger
    Join Date
    Jul 2003
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel print script (Excel XP)

    Thanks Jan,

    It's working perfectly. I also had some like this, but now I found it.

    Gerben

Posting Permissions

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