I need to print off about 12 different workbooks from one of our network drives but only if they have been modified that day. I do this every Monday morning and need the entire workbooks printed (all sheets). Any suggestions?
Darlene
I need to print off about 12 different workbooks from one of our network drives but only if they have been modified that day. I do this every Monday morning and need the entire workbooks printed (all sheets). Any suggestions?
Darlene
Try this:
If checking the date isn't precise enough you can use time as well. ModDate will have the date and time of the last modification for you to check against.Option Explicit Sub OpenFiles() Dim Path As String Dim FileName As String Dim Wkb As Workbook Dim ModDate As Date Application.EnableEvents = False Path = "C:\" 'Change as needed FileName = Dir(Path & "\*.xls", vbNormal) Do Until FileName = "" Set Wkb = Workbooks.Open(FileName:=Path & "\" & FileName) ModDate = Wkb.BuiltinDocumentProperties("Last Save Time") MsgBox ModDate If ModDate > Date - 1 Then 'Print Else 'No Print End If Wkb.Close False FileName = Dir() Loop Application.EnableEvents = True End Sub
Thank You Jacob, works fine with a few modifications.
Darlene
You're Welcome
Take Care