help me understand, I am trying to write a VBA function that can act as a library function for opening solidworks sketches. I already have a function library (its not a dll i just load it up as a .bas file in every project i need it). And now i want to add a function that opens up a sketch by a certain name. It needs to open the function in the current part file, no matter if it is already absorbed into a feature like an extrude. If it does not exist, there should be a messagebox indicating that. Here is the code I have so far:

'OPENSKETCH                                                                                                                                                                                                                 '
Sub openSketch(ByVal sketchName As String)
    Dim swApp As Object
    Dim Part As Object
    Dim feature As Object

    ' Connect to SolidWorks application
    Set swApp = Application.SldWorks

    ' Use the active document
    Set Part = swApp.ActiveDoc
    If Part Is Nothing Then
        MsgBox "No active document found. Please open a document and try again."
        Exit Sub
    End If
    
    'print out feature names
    Set feature = Part.FirstFeature
    Do While Not feature Is Nothing
        Debug.Print feature.Name & ": " & feature.GetTypeName2
        Set feature = feature.GetNextFeature
    Loop

    ' Find and select the sketch
    Set feature = Part.FirstFeature
    Do While Not feature Is Nothing
        If feature.GetTypeName2 = "ProfileFeature" Then
            If feature.Name = sketchName Then
                ' Edit the sketch
                Part.EditSketchOrReadOnly
                Exit Sub
            End If
        End If
        Set feature = feature.GetNextFeature
    Loop

    ' If the sketch was not found
    MsgBox "Sketch '" & sketchName & "' not found."
End Sub

You wrote this, but it does not find the one existing sketch in my file, it does print out that it finds a entity of the name i specified (called the function with "sketch_test", but it only finds an entry of type 'profilefeature' .
You previously said a sketch shouldnt be labeled a profilefeature, so this we need to understand better and correct.

You said before profilefeature is not the type that a sketch would usually be, but my sketch, which just has a single dot in it on the origin, and is called "sketch_test" does show up as such in the print log created by the function, I will drop it below here:

Current Part Name: sketchPatTest.SLDPRT
Comments: CommentsFolder
Favorites: FavoriteFolder
Folder : HistoryFolder
Selection Sets: SelectionSetFolder
Sensors: SensorFolder
Design Binder: DocsFolder
Annotations: DetailCabinet
Surface Bodies: SurfaceBodyFolder
Solid Bodies: SolidBodyFolder
Lights, Cameras and Scene: EnvFolder
Markups: InkMarkupFolder
Equations: EqnFolder
Material <not specified>: MaterialFolder
Front Plane: RefPlane
Top Plane: RefPlane
Right Plane: RefPlane
Origin: OriginProfileFeature
sketch_test: ProfileFeature

So as you can see from the log, the sketch shows up as profilefeature, even tho it is a sketch that is not used for any feature like extrudes, its just a sketch with a single point in it on the origin.