Guest User

Untitled

a guest
Mar 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. Sub Export()
  2. '
  3. ' Export Macro
  4. ' Export Rules and Privileges to 'Rules.csv' and Privileges.csv'
  5. '
  6. ' Keyboard Shortcut: Ctrl+Shift+E
  7. '
  8. Dim ws As Worksheet
  9. Dim path As String
  10.  
  11. path = ActiveWorkbook.path & ""
  12. For Each ws In Worksheets
  13. If ws.Name Like "Rules" Then
  14. ws.Activate
  15. ws.SaveAs Filename:=path & "Rules.csv", FileFormat:=xlCSV, CreateBackup:=True
  16. End If
  17. If ws.Name Like "Privileges" Then
  18. ws.Activate
  19. ws.SaveAs Filename:=path & "Privileges.csv", FileFormat:=xlCSV, CreateBackup:=True
  20. End If
  21. Next
  22. Range("B9").Select
  23. Application.Run "RulesWorkbook.xlsm!Export"
  24. Range("B4").Select
  25. End Sub
  26.  
  27. Sub Export()
  28. '
  29. ' Export Macro
  30. ' Export SecurityRules and Privileges to 'Rules.csv' and 'Privileges.csv'
  31. '
  32. ' Keyboard Shortcut: Ctrl+Shift+E
  33. '
  34. Dim ws As Worksheet
  35. Dim path As String
  36.  
  37. path = ActiveWorkbook.path & ""
  38. For Each ws In Worksheets
  39. If ws.Name Like "Rules" Then
  40. ws.SaveAs Filename:=path & "Rules.csv", FileFormat:=xlCSV, CreateBackup:=True
  41. End If
  42. If ws.Name Like "Privileges" Then
  43. ws.SaveAs Filename:=path & "Privileges.csv", FileFormat:=xlCSV, CreateBackup:=True
  44. End If
  45. Next
  46. Application.DisplayAlerts = False
  47. ActiveWorkbook.Close
  48. Application.DisplayAlerts = True
  49. End Sub
Add Comment
Please, Sign In to add comment