Excel VBA到sharepoint列表

Excel VBA到sharepoint列表,excel,vba,sharepoint,sharepoint-list,Excel,Vba,Sharepoint,Sharepoint List,我使用以下脚本从Excel复制数据并将其批量添加到sharepoint列表: Sub AddItems() ' ' Requires a reference to "Microsoft ActiveX Data Object 6.0 Libray" to insert a record into a sharepoint list "AccessLog" ' Dim cnt As ADODB.Connection Dim rst As AD

我使用以下脚本从Excel复制数据并将其批量添加到sharepoint列表:

Sub AddItems()
'
' Requires a reference to "Microsoft ActiveX Data Object 6.0 Libray" to insert a record into a sharepoint list "AccessLog"
'
    Dim cnt As ADODB.Connection
    Dim rst As ADODB.Recordset
    Dim mySQL As String

    Set cnt = New ADODB.Connection
    Set rst = New ADODB.Recordset

    mySQL = "SELECT * FROM [Test];"

    With cnt ' See https://www.connectionstrings.com/sharepoint/

.ConnectionString = _
        "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=0;RetrieveIds=Yes;DATABASE=https://share.amazon.com/sites/IPV;List={2B0ED605-AE50-4D39-A46E-77CC15D6F17E};"
        .Open
    End With

    rst.Open mySQL, cnt, adOpenDynamic, adLockOptimistic
    
    Set ColumnToCheck = Worksheets("Audits_10d").Range("A1:A2000")

    For Counter = 16 To 24
       
       ValueToCheck = Sheets("Audits").Cells(Counter, 28).Value

       If IsError(Application.Match(ValueToCheck, ColumnToCheck, 0)) Then
            rst.AddNew
            rst.Fields("Task ID") = Sheets("Audits").Cells(Counter, 28).Value
            rst.Fields("Seller ID") = Sheets("Audits").Cells(Counter, 5).Value
            rst.Fields("Site") = Sheets("Audits").Cells(Counter, 30).Value
            rst.Fields("Mktpl") = Sheets("Audits").Cells(Counter, 2).Value
            rst.Fields("Country") = Sheets("Audits").Cells(Counter, 31).Value
            rst.Fields("Inv_Date") = Sheets("Audits").Cells(Counter, 32).Value
            rst.Fields("Associate_Login") = Sheets("Audits").Cells(Counter, 8).Value
            rst.Fields("Manager_Login") = Sheets("Audits").Cells(Counter, 33).Value
            rst.Fields("Associate Action") = Sheets("Audits").Cells(Counter, 10).Value
            rst.Fields("Correct Associate Action") = Sheets("Audits").Cells(Counter, 11).Value
            rst.Fields("SIV Action") = Sheets("Audits").Cells(Counter, 20).Value
            rst.Fields("Correct SIV Action") = Sheets("Audits").Cells(Counter, 21).Value
            rst.Fields("SIV RFI/RFD reason") = Sheets("Audits").Cells(Counter, 23).Value
            rst.Fields("Data Correctly Captured").Value = Sheets("Audits").Cells(Counter, 26).Value
        
      End If
    Next Counter
            
            
            
            
    rst.Update ' commit changes to SP list

    If CBool(rst.State And adStateOpen) = True Then rst.Close
    If CBool(cnt.State And adStateOpen) = True Then cnt.Close
End Sub
我只是遇到了一个小问题,因为sharepoint列表中的一些选项是一个带有yes/no选项的复选框:

有什么办法可以解决这个问题吗?因为在我的excel中,我设置了“是”或“否”选项,但似乎不起作用,所以我想它必须有一个正确或错误的标准

提前谢谢