I have just spent the last couple of days creating a Risk Assessment spreadsheet and have used a very useful tutorial that I found online for creating a picklist and print button to generate a list of worksheets and print the selected ones.
the code is as follows :
Sub Print_Sheets()
Dim i As Long, c As Long
Dim SheetArray() As String
With ActiveSheet.ListBoxSh
For i = 0 To .ListCount - 1
If .Selected(i) Then
ReDim Preserve SheetArray(c)
SheetArray(c) = .List(i)
c = c + 1
End If
Next i
Sheets(SheetArray()).PrintPreview
'If you'd like to print out
'Sheets(SheetArray()).PrintOut
End With
End Sub
This is the first time I have used VBA and I have checked the print preview throughout to check that each worksheet looks as I want it to. All has been very successful.
I have now tried to actually print a workbook and all goes well, selected sheets are sent to print preview etc but when clicking print, all printers are doubled up in the printer selection box and when a printer is selected, the documents print twice, even the PDF option runs the PDF creator twice.
Printers are only shown once when using standard print options. It seems to be the “Sheets(SheetArray()).PrintPreview” command that’s doing it.
I have tried the spreadsheet on a different computer, different network & printers and still the same result.
Can anyone help ?
Bookmarks