ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MACRO TO COUNT ALL OPEN WORKBOOKS and print (https://www.excelbanter.com/excel-programming/442460-macro-count-all-open-workbooks-print.html)

JOSEPH WEBER

MACRO TO COUNT ALL OPEN WORKBOOKS and print
 
I need to know if there is a way i can run a macro to count all open
workbooks and print "sheet1" of all open workbooks. The macro should close
each workbook after printing the first sheet.

Per Jessen

MACRO TO COUNT ALL OPEN WORKBOOKS and print
 
Hi

Here's a way

Sub aaa()
For Each wb In Application.Workbooks
wb.Sheets("Sheet1").PrintOut
wb.Close savechanges:=True 'Or false
counter = counter + 1
Next
msg = MsgBox(counter & " sheets has been printed", vbInformation + vbOKOnly)
End Sub

Regards,
Per

"JOSEPH WEBER" skrev i meddelelsen
...
I need to know if there is a way i can run a macro to count all open
workbooks and print "sheet1" of all open workbooks. The macro should close
each workbook after printing the first sheet.




All times are GMT +1. The time now is 12:02 AM.

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