Hello @Mehmet_Fatih_Turker,
yes you can. it is basically all in the help of Inventor.
so if you use the addforsolid, you can specify some optional input.
If you want the whole sketch to be extruded then you don't put in anything, but in your case you can.
so create the two rectangles, (oRectangleLines3, and oRectangleLines4)... (names in the code)
then in the addforsolid you can only pass an objectcollection, so create the object collecction and add only the largest rectangle to it.
then if you create te profile, pass in the object colletion.
try you self to change the first option from false tot true (should be false)
the code:
Public Sub Main()
' Check to make sure a sketch is open.
If Not TypeOf ThisApplication.ActiveEditObject Is PlanarSketch Then
MsgBox ("A sketch must be active.")
Exit Sub
End If
' Set a reference to the active sketch.
Dim oSketch As PlanarSketch
oSketch = ThisApplication.ActiveEditObject
' Set a reference to the transient geometry collection.
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry
Dim oRectangleLines3 As SketchEntitiesEnumerator
oRectangleLines3 = oSketch.SketchLines.AddAsTwoPointCenteredRectangle( _
oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(5, 5))
Dim oRectangleLines4 As SketchEntitiesEnumerator
oRectangleLines4 = oSketch.SketchLines.AddAsTwoPointCenteredRectangle( _
oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(6, 6))
Dim partDoc As PartDocument = ThisDoc.Document
Dim oCompDef = partDoc.ComponentDefinition
Dim objcol = ThisApplication.TransientObjects.CreateObjectCollection(oRectangleLines4)
Dim oProfile As Profile
oProfile = oSketch.Profiles.AddForSolid(False, objcol)
' Create a base extrusion 1cm thick.
Dim oExtrudeDef As ExtrudeDefinition
oExtrudeDef = oCompDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kJoinOperation)
oExtrudeDef.SetDistanceExtent(1, kNegativeExtentDirection)
Dim oExtrude As ExtrudeFeature
oExtrude = oCompDef.Features.ExtrudeFeatures.Add(oExtrudeDef)
End Sub
succes
If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated

Succes on your project, and have a nice day
Herm Jan