Save Sheet from Workbook to Sharepoint

MrPink1986

Active Member
Joined
May 1, 2012
Messages
250
Hi there,

I have a macro enabled workbook with multiple sheets - I want to save one sheet from this workbook on to SharePoint. The sheet I want to save is "Output".
VBA Code:
Sub UploadtoSharePoint()
Dim pathsp As String
Dim SDate As String
Dim FDate As String
Set wb = ActiveWorkbook
Sheets("Output").Select
Set shtE = ActiveSheet
'Sheets("Overview").Select
'Set shtView = ActiveSheet
SDate = shtE.Range("C3").Value
FDate = VBA.Format(shtE.Range("C3").Value, "yyyy-mm-dd") & ".xlsx"
Set wbTemp = Workbooks.Open(stalesP & FDate, UpdateLinks:=False)
Set shtTemp = ActiveSheet
pathsp = "https://xxxprod.sharepoint.com/:f:/r/sites/xxxxxmplemenation/Shared%20Documents/General?csf=1&web=1&e=eZCkOH/"
wbTemp.SaveAs pathsp & "Output----" & FDate, FileFormat:=51, CreateBackup:=False
wbTemp.Close savechanges:=False
End Sub

The error I get is that Excel cant find the find the file (Run time error '1004) - it is like it is looking for the file before it is saved?
Any help with this one is greatly appreciated.

Thanks
Stephen
 

Attachments

  • 1600093365659.png
    1600093365659.png
    24.8 KB · Views: 3

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Watch MrExcel Video

Forum statistics

Threads
1,112,814
Messages
5,542,639
Members
410,563
Latest member
csirtlab
Top