Good Morning,
I posted yesterday with a query on how to stop files automatically opening when they are printed to a file (http://www.excelforum.com/excel-prog...d-to-file.html).
I managed to resolve this by finding out there was a checkbox in the "Save As" box that pops up when you choose "Print to File". Now while I can go through all the workbooks that I need to print, and save them with this checkbox unchecked it would be much neater if there was a way to do this through the same macro that I use for printing out all the sheets in the workbook.
So my question is, can this checkbox be manipulated through VBA or will I just have to bite the bullet and go through all the workbooks manually ensuring that this checkbox is unchecked. (If there is a way of turning this off altogether through excel itself then that would be a solution but I don't believe that there is)
I have been scouring Google for the last day or so and have so far come up with nothing so any pointers/hints to get me going in the right direction would be very much appreciated.
Below is my code just in case anyone wants it :-
Sub PrintAllSheets()
Dim Current As Worksheet
Dim n As Integer
Dim c As Integer
n = Application.Workbooks.Count
For c = 1 To n 'This loops through all open workbooks
For Each Current In Application.Workbooks(c).Worksheets 'This loop will execute for every worksheet in the currently active workbook
If Current.Name <> "Blank" And Current.Visible = xlSheetVisible Then 'Ignores the first Blank Sheet and any Hidden sheets
Application.ActivePrinter = "Microsoft Office Document Image Writer on Ne01:"
Current.PrintOut Copies:=1, PrintToFile:=True, Collate _
:=True, PrToFileName:="C:\" & Current.Name & ".tif"
End If
Next
Next c
End Sub
Thanks in advance,
Ben
Bookmarks