Reputation: 33
I get an error on the 'Save on Sharepoint' section. any feedback on my code to save this file to my sharedrive and to a Sharepoint site daily with today's date at the end.
Sub sharepointsave()
'Open Excel
Set xl = CreateObject("Excel.Application")
xl.Workbooks.Open ("S:\Common\test.xlsx")
xl.Visible = True
Application.DisplayAlerts = False
'Copy and Save As
xl.ActiveWorkbook.SaveAs Filename:=("S:\Common\test_" & Format(Now(), "YYYYMMDD") & ".xlsx"), FileFormat:=xlOpenXMLWorkbook
'Save on Sharepoint
xl.ActiveWorkbook.SaveAs Filename:=("//aticsi.sharepoint.com/sites/test_" & Format(Now(), "YYYYMMDD") & ".xlsx"), FileFormat:=xlOpenXMLWorkbook
'Close without saving over xlsm
xl.ActiveWorkbook.Saved = True
xl.Quit
Set xl = Nothing
End Sub
Upvotes: 1
Views: 5984
Reputation: 166585
This works for me:
ActiveWorkbook.SaveAs "https://mycompany.sharepoint.com/sites/MySite/TestLibrary/Test.xlsx"
Upvotes: 2