I have a list that uses multiple content types and I am uploading bulk changes to the list from an excel document via VBA and the ADODB.recordset.
I can edit existing records without any issues. However, when creating new, I cannot specify the content type: the Content Type field is readable but I am unsuccessful in writing to it – all records created are the default content type.
Can anyone offer any pointers on my code?
Private Sub ConnectWorklist() Set SPConnection = New ADODB.Connection Set SPRecordSet = New ADODB.Recordset Dim SQLQuery As String SQLQuery = "SELECT * FROM [" & listGUID & "];" With SPConnection .ConnectionString = _ "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=0;RetrieveIds=Yes;" & _ "DATABASE=" & sharepoint_url & _ ";LIST=" & listGUID & ";" .Open End With SPRecordSet.Open SQLQuery, SPConnection, adOpenDynamic, adLockOptimistic With SPRecordSet .MoveLast .AddNew ![Title] = Title ![External ID] = ExternalID ![Content Type] = "Project" End With SPRecordSet.Update End Sub