I am trying to have a PowerShell script print an Excel 2010 file automatically while choosing a specific printer and number of copies.
Here is what I currently have and it does open my Excel file and print it but it is only printing one copy and to the Windows default printer.
#$xlLandscape = 2 $xl = New-Object -comobject excel.application $xl.Visible = $true $wb = $xl.Workbooks.Open("C:\Users\swalker\Desktop\WIPBinLocations.xlsx") # $ws = $wb.Worksheets.Item(1) #$ws.PageSetup.Orientation = $xlPortrait $ws.Copies = 2 #$ws.ActivePrinter = 'Manufacturing Rcv HP LaserJet 4250 PCL6 on FILE' $ws.ActivePrinter = "HP Officejet Pro L7500 Series" $wb.printout() $wb.Close # Quit Excel. $xl.quit() spps -n excel
It is not using my Copies and ActivePrinter settings. If you could point me in the right direction to fix my problem it would be much appreciated.
Thanks,
Stacy