none
How to use ListObject.UpdateChanges correct RRS feed

  • Question

  • Hi @ all

    I place a ListObject in Document level mode in Excel. This ListObject is generate by code below.

    Generate Listobject

     
    Imports System
    Imports System.Collections.Generic
    Imports System.Linq
    Imports System.Text
    Imports System.Windows.Forms
    Imports System.Data
    Imports System.Xml
    Imports ExcelWorkbook1.SharePointListSync
    Imports ExcelWorkbook1.SharePointListDetails
    Imports Microsoft.SharePoint.Client
    Imports SP = Microsoft.SharePoint.Client
    Imports Microsoft.Office.Interop.Excel
    Imports Microsoft.Office.Tools.Excel

    Dim ListCheck As Boolean Dim ListCounter As Integer Dim ListName As String Dim NativeWorkbook As Microsoft.Office.Interop.Excel.Workbook = Globals.ThisWorkbook.Application.ActiveWorkbook Dim NativeWorksheet As Microsoft.Office.Interop.Excel.Worksheet = Globals.ThisWorkbook.Application.ActiveWorkbook.ActiveSheet Dim worksheet As Microsoft.Office.Tools.Excel.Worksheet = Globals.Factory.GetVstoObject(NativeWorksheet) Dim list1 As Microsoft.Office.Tools.Excel.ListObject Dim cell As Excel.Range = worksheet.Range("$A$1:$D$4") list1 = worksheet.Controls.AddListObject(cell, NativeWorksheet.Name & "_" & "SPList1") list1.DataSource = Nothing list1.DataSource = Globals.ThisWorkbook.DSlists.SPResult list1.AutoSelectRows = True list1.AutoSetDataBoundColumnHeaders = True ListCheck = True end sub

    This work fine.

    Then I want update all ListObject modification which are made in Excel back to SharePoint

    My problem is that I don't get access to this command. I use this code line below. What is wrong in my thinking?

    
    Imports System
    Imports System.Collections.Generic
    Imports System.Linq
    Imports System.Text
    Imports System.Windows.Forms
    Imports System.Data
    Imports System.Xml
    Imports ExcelWorkbook1.SharePointListSync
    Imports ExcelWorkbook1.SharePointListDetails
    Imports Microsoft.SharePoint.Client
    Imports SP = Microsoft.SharePoint.Client
    Imports Microsoft.Office.Interop.Excel
    Imports Microsoft.Office.Tools.Excel

    Private Sub BtnSyncToList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSyncToList.Click Dim NativeWorksheet As Microsoft.Office.Interop.Excel.Worksheet = Globals.ThisWorkbook.Application.ActiveWorkbook.ActiveSheet Dim vstoWorksheet As Microsoft.Office.Tools.Excel.Worksheet = Globals.Factory.GetVstoObject(NativeWorksheet) Dim strobjLsname As String = NativeWorksheet.Name & "_" & "SPList1" objListObj = Globals.Factory.GetVstoObject(NativeWorksheet.ListObjects(NativeWorksheet.Name & "_" & "SPList1")) Try 'Here is my problem after objListObj I don't get the command UpdateChanges objListObj.UpdateChanges(Excel.XlListConflict.xlListConflictRetryAllConflicts) Catch ex As Global.System.InvalidCastException End Try End Sub

    Thanks for help



    • Edited by Richard_MP Wednesday, August 20, 2014 9:03 AM
    • Moved by Carl Cai Thursday, August 21, 2014 1:44 AM (from vb.net)more related
    Wednesday, August 20, 2014 8:58 AM

All replies

  • Hi Boy88,

    I have helped you move this thread to more related forum to get supports.

    Regards.

    Carl


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, August 21, 2014 1:45 AM