Guest User

Untitled

a guest
Nov 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. Sub SaveWorksheetsAsXLSX()
  2.  
  3. Dim WS As Excel.Worksheet
  4. Dim SaveToDirectory As String
  5.  
  6. Dim CurrentWorkbook As String
  7. Dim CurrentFormat As Long
  8.  
  9. CurrentWorkbook = ThisWorkbook.FullName
  10. CurrentFormat = ThisWorkbook.FileFormat
  11. ' Store current details for the workbook
  12. SaveToDirectory = "\\tempest-dc01\data\Clients\Synectics\Customer Excellence 2017\Output\Verbatims - Cleaned\"
  13. For Each WS In ThisWorkbook.Worksheets
  14. Sheets(WS.Name).Copy
  15. ActiveWorkbook.SaveAs Filename:=SaveToDirectory & "Synectics Customer Excellence 2017 Verbatims " & "- " & WS.Name & ".xlsx", FileFormat:=51
  16. ActiveWorkbook.Close savechanges:=False
  17. ThisWorkbook.Activate
  18. Next
  19.  
  20. Application.DisplayAlerts = False
  21. ThisWorkbook.SaveAs Filename:=CurrentWorkbook, FileFormat:=CurrentFormat
  22. Application.DisplayAlerts = True
  23. ' Temporarily turn alerts off to prevent the user being prompted
  24. ' about overwriting the original file.
  25.  
  26. End Sub
Add Comment
Please, Sign In to add comment