VBA to add bolts from Toolbox to selected holes

I have a problem with my code. How do I overcome this problem to automatically add bolts into holes from Toolbox? Or is there already a API to do that?

My code is as follows: 

"
Sub main()

Dim swApp As SldWorks.SldWorks
Set swApp = Application.SldWorks
Dim swModel As SldWorks.ModelDoc2
Set swModel = swApp.ActiveDoc

If swModel.GetType() <> swDocPART Then
MsgBox "Please open a part."
Exit Sub
End If

' Display a message box asking the user to confirm adding the bolts and flat washers, we assume that user has already selected
Dim result As Integer
result = MsgBox("Do you want to add the bolts and flat washers to the selected holes?", vbYesNo)
If result = vbYes Then

' Get the selected holes

Dim selectedHoles As Object
Set selectedHoles = swModel.SelectionManager.GetSelectedSketchPoints
If Not (selectedHoles Is Nothing) And selectedHoles.Count > 0 Then
Dim i As Long
For i = 0 To selectedHoles.Count - 1
Dim skp As SketchPoint
Set skp = selectedHoles.Item(i)
Dim x As Double, y As Double, z As Double
x = skp.x
y = skp.y
z = skp.z
' Add the bolt to the selected holes
' Set the orientation of the component
Dim mat As Object
Set mat = swModel.CreateMatrix3(x, y, z, 0, 0, 1, 0, 1, 0, 0, 0, 1)
 
' Open the Design Library
Dim swLibpart As Object
Set swLibpart = swApp.OpenDoc6("C:\\SOLIDWORKS Data\\browser\\Ansi Metric\\bolts and screws\\hex head\\formed hex screw_am.SLDPRT", swDocumentTypes_e.swDocPART, swOpenDocOptions_e.swOpenDocOptions_Silent, "", 0, 0)
' Insert the bolt into the model
Dim feature As Object
Set feature = swModel.FeatureManager.InsertReferencedComponent2(swLibpart, "", x, y, z, 0, 0, 0, 1, 1, 1, "", mat, 0, 0)
Next
Else
' Inform the user that no bolts and flat washers were added
MsgBox "No bolts or flat washers were added"
End If
End If

End Sub
"

Error code: Object doesn't support this property or method (Error 438)

I feel like I've tried everything now.

Edu ​​​​​​​