nemmi69
Well-known Member
- Joined
- Mar 15, 2012
- Messages
- 938
- Office Version
- 365
- 2019
- 2016
- 2013
- Platform
- 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
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.
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.
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