Excel update table back to Sharepoint

nemmi69

Well-known Member
Joined
Mar 15, 2012
Messages
938
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows
So thanks to JEC I sorted my columns out but have an issue with writing the table data back to Sharepoint

I have been given full rights in Sharepoint but I get various fails

VBA Code:
'Primary part'
Const SPSITE = "xxxxxxxxxx.sharepoint.com/teams/xxxxxxxTeam"
Const SRCLIST = "{57FDE37F-5EBD-zzzz-xxxx-EBE432345E2B}"
Public WbName As Workbook
Public  WsName4 As Worksheet
Dim MyTableName As String
Dim ObjListTable As ListObject
Dim Src(0 To 1) As Variant

Sub DownloadShareTable()
Set WbName = ThisWorkbook
Windows(ThisWorkbook.Name).Activate
Set WsName4 = WbName.Sheets("EquipmentList")

'Download Sharepoint table'
Src(0) = "https://" & SPSITE & "/_vti_bin"
Src(1) = SRCLIST
'Src(1) = SRCVIEW

WsName4.ListObjects.Add xlSrcExternal, Src, True, xlYes, WsName4.Range("A1")
Set ObjListTable = WsName4.ListObjects(1)
End Sub


So the following gives the error "Run-time error '1004' Application-defined or object-defined error" . In other words it has no clue what the error is.

Code:
Sub UpdateSharepointList1()
ObjListTable.UpdateChanges XlListConflict.xlListConflictError
End Sub

Version 2 gives the error " '-2147467259 (80004005)': Cannot connect to the server at this time. Your table cannot be published.". If I hit refresh though the table will refresh so server is there.

Code:
Sub UpdateSharepointList2()
Dim TableTxt As String
Dim Wrk As String
Dim Wrk1 As String
Dim strPublish As String
Dim Srcx(0 To 1) As Variant

Wrk = Left(ObjListTable.SharePointURL, Len(ObjListTable.SharePointURL) - 14)  'Remove "/Allitems.aspx"
Wrk1 = ObjListTable.DisplayName

Srcx(0) = Wrk
Srcx(1) = Wrk1

'strPublish = ObjListTable.Publish(Srcx, False)
End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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