Alan, here is something that works for a product, your selection is defined for it...
I also added, and commented away a way to get hold of a part in assembly...
Sub CATMain()
Dim oManuName
oManuName = 3 'InputBox("Enter Screw size M?")
Dim holeDia
Dim holeHDAngle
Dim holeHDDepth
Dim holeName
If oManuName = 3 Then holeDia = 3.5
If oManuName = 3 Then holeHDAngle = 90#
If oManuName = 3 Then holeHDDepth = 1.86
If oManuName = 3 Then holeName = "C/Sunk Hole for M3 CSHS"
Dim product1 As Product
Set product1 = CATIA.ActiveDocument.Product
Dim oSelection
Set oSelection = CATIA.ActiveDocument.Selection
oSelection.Clear
'Dim oPartProduct As Product
'Dim oPartDocument As Document
'Dim oPart As Part
'For Each oPartProduct In product1.Products
' Set oPartDocument = oPartProduct.ReferenceProduct.Parent
' Set oPart = oPartDocument.Part
oSelection.Search "Type=Hole,all"
'Next
For i = 1 To oSelection.Count
Set oHole1 = oSelection.item(i).Value
oHole1.Type = catSimpleHole
oHole1.ThreadingMode = catSmoothHoleThreading
oHole1.BottomLimit.LimitMode = catUpThruNextLimit
oHole1.Diameter.Value = holeDia
oHole1.Type = catSimpleHole
oHole1.Type = catCountersunkHole
oHole1.CounterSunkMode = catCSModeDepthAngle
oHole1.HeadAngle.Value = holeHDAngle
oHole1.HeadDepth.Value = holeHDDepth
oHole1.name = holeName & "." & i
Next
product1.Update
End Sub
regards,
LWolf