Community
I get an error
Run-time error '91':
Object variable or With block variable not set
when running this code
Option Explicit Dim oWorkSurf As WorkSurface Dim oWorkSurfs As WorkSurfaces Dim oSurfBody As SurfaceBody Dim oSurfBodies As SurfaceBodies Dim oCompDef As ComponentDefinition Dim oPartCompDef As PartComponentDefinition Dim oPartDoc As PartDocument Dim oSplitFeat As SplitFeature Public Sub SplitAllFaces() Set oPartDoc = ThisApplication.ActiveDocument Set oPartCompDef = oPartDoc.ComponentDefinition Set oSurfBodies = oPartCompDef.SurfaceBodies Set oWorkSurfs = oPartCompDef.WorkSurfaces oWorkSurf = oWorkSurfs.Item("Srf5") For Each oSurfBody In oSurfBodies Set oSplitFeat = oPartCompDef.Features.SplitFeatures.SplitBody(oWorkSurf, oSurfBody) Next oSurfBody End Sub
I'm not sure why. I've tried Item ("Srf5"), Item(1), and Item("Surface2"). All give the same result.
Solved! Go to Solution.
Solved by jpblower. Go to Solution.