Hi
I was given a macro that should open a sharepoint file. I believe that it shouldnt be in the workbook that I open but somewhere else.
Where do I put it? Tried putting in new workbook and running and says the file dont exist but it is in sharepoint.
I was given a macro that should open a sharepoint file. I believe that it shouldnt be in the workbook that I open but somewhere else.
Where do I put it? Tried putting in new workbook and running and says the file dont exist but it is in sharepoint.
VBA Code:
Sub OpenAndCloseWBFromSharePointFolder()
'If nobody has the file checked out
If Workbooks.CanCheckOut("https://arrivagroup.sharepoint.com/:x:/r/teams/O365GRP-StationAccounts/Shared%20Documents/General/test.xlsm?d=wdcc3d7b614284396a2cb4564704dff53&cs") = True Then
Application.DisplayAlerts = False
'Open the file on the SharePoint server
Workbooks.Open Filename:="https://arrivagroup.sharepoint.com/:x:/r/teams/O365GRP-StationAccounts/Shared%20Documents/General/test.xlsm?d=wdcc3d7b614284396a2cb4564704dff53&csF", UpdateLinks:=xlUpdateLinksNever
'Close the workbook
Workbooks("test.xlsm").Close
Application.DisplayAlerts = True
Else
Application.DisplayAlerts = False
'Open the File to check if you already have it checked out
Workbooks.Open Filename:="https://arrivagroup.sharepoint.com/:x:/r/teams/O365GRP-StationAccounts/Shared%20Documents/General/test.xlsm?d=wdcc3d7b614284396a2cb4564704dff53&cs", UpdateLinks:=xlUpdateLinksNever
'See if doc can be checked in
If Application.Workbooks("test.xlsm").CanCheckIn Then
'Check In, Save and Close
Application.Workbooks("ExcelList.xlsb").CheckIn SaveChanges:=True, Comments:="Checked-In before Delete"
'Open the file again
Workbooks.Open Filename:="https://arrivagroup.sharepoint.com/:x:/r/teams/O365GRP-StationAccounts/Shared%20Documents/General/test.xlsm?d=wdcc3d7b614284396a2cb4564704dff53&cs"
'Close the workbook
Workbooks("test.xlsm").Close
End If
End If
End Sub