Guest User

Untitled

a guest
Nov 22nd, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. Private Sub Workbook_AfterSave(ByVal Success As Boolean)
  2.  
  3. Dim UploadToSharepoint As Boolean
  4.  
  5. Dim SharePointLib As String
  6. Dim myPath As String
  7. Dim folderPath As String
  8. Dim objNet As Object
  9. Dim FS As Object
  10. Dim copyPath As String
  11. Dim copyFilePath As String
  12.  
  13. folderPath = Application.ActiveWorkbook.path
  14. myPath = Application.ActiveWorkbook.FullName
  15. MsgBox "This is the folderPath" & folderPath 'C:UsersusernameDesktop
  16. MsgBox "This is the filepath" + myPath 'C:UsersusernameDesktoptesting.xlsm
  17.  
  18. SharePointLib = "https://company.com/sites/"
  19. copyPath = folderPath + "copyPath"
  20. MsgBox "The copyPath is = " & copyPath 'C:UsersusernameDesktopcopyPath
  21.  
  22. If Not FolderExists(copyPath) Then
  23. FolderCreate (copyPath)
  24. End If
  25.  
  26. 'SharePointLib = SharePointLib & FileNameWithExt(copyPath)
  27.  
  28. MsgBox "The file will be uploaded to this address: " + SharePointLib 'https://company.com/sites/
  29.  
  30. ThisWorkbook.SaveCopyAs copyPath & "testing.xlsm"
  31. Call FileCopy(copyPath & "testing.xlsm", SharePointLib)
  32.  
  33. Exit Sub
  34.  
  35. loadFailed:
  36. UploadToSharepoint = False
  37.  
  38. End Sub
Add Comment
Please, Sign In to add comment