LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Print a selected number of sheets

I have a number of sheets in a workbook and a selection of 4 need to be
printed on a regular basis. Each of those sheets have been formatted to
print a selected area.
What I would like (and I already some code, as below), is to amend the code
so that it will print to PDF but only ask for a file name once. ie it will
print the selected sheets into the one PDF document.

Rob

Option Explicit

Private Sub CancelButton_Click()
Unload Me
End Sub

Private Sub OKButton_Click()
Dim i As Long
Application.ActivePrinter = "Adobe PDF on Ne06:"

If ListBox1.Selected(0) = False And _
ListBox1.Selected(1) = False And _
ListBox1.Selected(2) = False And _
ListBox1.Selected(3) = False Then
MsgBox "Select from the list.", vbInformation
Exit Sub
End If

' choose an item
Me.Hide
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Worksheets(ListBox1.List(i)).PrintOut From:=1, To:=1
End If
Next i
'Me.Show

Dim FoundOne As Boolean

FoundOne = False
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
FoundOne = True
Exit For
End If
Next i

Unload Me
End Sub

Private Sub UserForm_Initialize()
With ufPrintNo.ListBox1
.RowSource = ""
.AddItem Sheet3.Name
.AddItem Sheet9.Name
.AddItem Sheet2.Name
.AddItem Sheet10.Name
.MultiSelect = fmMultiSelectMulti
End With

End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print preview and print only shows 2/3 of page selected Financial planner Excel Discussion (Misc queries) 1 January 9th 07 06:26 PM
How do I print a workbook in but only print selected worksheets? Karl S. Excel Discussion (Misc queries) 1 August 31st 06 12:34 AM
Printing selected sheets. Rafat Excel Worksheet Functions 1 June 9th 06 03:13 PM
How to print a selected number of sheets? Rafat Excel Worksheet Functions 0 June 9th 06 02:50 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM


All times are GMT +1. The time now is 09:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"