Hi, I am using the code below to print documents, I want to be able to force it to print to a specific printer. Several people use this and we are all set up to different default printers so I want it to print out at a specific printer without having the change our printers. Can this be done and can anyone please tell me what I need to add to the code? Many thanks
Code:
Sub PrintFiles()
Dim oFSO As Object
Dim lngLastRow As Long
Dim lngIndex As Long
Dim strFname As String
Dim xlSheet As Worksheet
Dim xlWB As Workbook
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set xlSheet = ActiveSheet
With xlSheet
lngLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For lngIndex = 1 To lngLastRow
strFname = .Range("A" & lngIndex)
If oFSO.FileExists(strFname) Then
'If oFSO.FileExists("C:\Path" & strFname) Then
'If oFSO.FileExists("C:\Path" & strFname & ".xls") Then
Set xlWB = Workbooks.Open(strFname)
'Set xlWB = Workbooks.Open("C:\Path" & strFname)
'Set xlWB = Workbooks.Open("C:\Path" & strFname& ".xls")
xlWB.Sheets(1).PageSetup.Zoom = 95
xlWB.Sheets(1).PrintOut From:=1, To:=1
ThisWorkbook.Sheets(2).PrintOut From:=1, To:=1
xlWB.Close savechanges:=False
Else
.Range("A" & lngIndex).Interior.Color = &H80FFFF
End If
Next lngIndex
End With
lbl_Exit:
Set oFSO = Nothing
Set xlSheet = Nothing
Set xlWB = Nothing
Exit Sub
End Sub