Save Sheet from Workbook to Sharepoint

MrPink1986

Active Member
Joined
May 1, 2012
Messages
252
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: 10

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,215,051
Messages
6,122,871
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top