Hi,

I have recently viewed this great tutorial on Youtube that has showed me how to add new items to a Sharepoint list - https://www.youtube.com/watch?v=1qu6u2x7Kms&t=29s. I now want to to be able to add an attachment to each new list entry also. Is there a way to modify the below code to do this? Any help/suggestions would be greatly appreciated.

Sub AddNewItem()
Dim cnt As ADODB.Connection
Dim rst As ADODB.Recordset
Dim mySQL As String

'set connection
Set cnt = New ADODB.Connection
Set rst = New ADODB.Recordset

'sql select statement
mySQL = "SELECT * FROM [ListName];"

'WHERE [Department] = 'Compensation';"

'open connection
With cnt
.ConnectionString = _
"Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=0;RetrieveIds=Yes;DATABASE=URLName;"
.Open
End With

'open table / recordset
rst.Open mySQL, cnt, adOpenDynamic, adLockOptimistic

rst.AddNew

rst.Fields("Location") = Sheets("Input").Range("A1").Value
rst.Fields("Parameter") = Sheets("Input").Range("A2").Value
rst.Fields("Owner") = Sheets("Input").Range("A3").Value

rst.Update

'close recordset/connection and clean memory
If CBool(rst.State And adStateOpen) = True Then rst.Close
Set rst = Nothing
If CBool(cnt.State And adStateOpen) = True Then cnt.Close
Set cnt = Nothing

End Sub