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

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,215,048
Messages
6,122,862
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