ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   store sheets listed in listbox in array (https://www.excelbanter.com/excel-programming/363085-store-sheets-listed-listbox-array.html)

Orhan

store sheets listed in listbox in array
 
Hi,

What I want is to store all sheets listed in ListBox2
(MultiSelectSingle) to an array and then print them to one PDF file.

My ListBox2 is in a UserForm and belongs to an .xla menu addin.

As PDF printer I use PDF reDirect Pro Batch Printer.

Thanks


Bob Phillips

store sheets listed in listbox in array
 
Dim ary
Dim j As Long, i As Long
ReDim ary(j)
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
ReDim Preserve ary(j)
ary(j) = .List(i)
j = j + 1
End If
Next i
End With


I'll leave the PDF bit to you

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Orhan" wrote in message
ups.com...
Hi,

What I want is to store all sheets listed in ListBox2
(MultiSelectSingle) to an array and then print them to one PDF file.

My ListBox2 is in a UserForm and belongs to an .xla menu addin.

As PDF printer I use PDF reDirect Pro Batch Printer.

Thanks





All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com