Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. Dim wBk As Workbook
  2. Dim sFileSpec As String
  3. Dim sPathSpec As String
  4. Dim sFoundFile As String
  5.  
  6. sPathSpec = "J:Secure Downloads"
  7. sFileSpec = "*.xl*"
  8.  
  9. sFoundFile = Dir(sPathSpec & sFileSpec)
  10. Do While sFoundFile <> ""
  11. Set wBk = Workbooks.Open(sPathSpec & sFoundFile)
  12. With wBk
  13. Application.DisplayAlerts = False
  14. wBk.SaveAs Filename:=.FullName, _
  15. Password:="summer"
  16. Application.DisplayAlerts = True
  17. End With
  18. Set wBk = Nothing
  19. Workbooks(sFoundFile).Close False
  20. sFoundFile = Dir
  21. Loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement