I tried your code without modification on a part: it works and exit the sketch.
It might comes from the part itself or some parameter
Could you link your file?
*Edit : It might have worked because I called the function from main sub with swmRebuild 0 0 0
See reply below
You're right. I read the API Help too. One of the Rebuild Function Type is "Modify". So, I suppose it's possible to modify a sketch and get out. The "EditRebuild3" was a desperate move.
As Rob said It comes from the function rebuild.
I changed it by a sub and it worked.
Dim App As Object 'SldWorks.SldWorks
Dim Doc As Object 'SldWorks.ModelDoc2
Dim SelMgr As SelectionMgr
Dim text As SketchText
Dim format As TextFormat
'Recovering SolidWorks objects
Set App = Application.SldWorks 'vrApp
Set Doc = App.ActiveDoc 'vrPart
'Set swMacroFeature = vrFeature
'Resizing the text
Set SelMgr = Doc.SelectionManager
Doc.Extension.SelectByID2 "Sketch7", "SKETCH", 0, 0, 0, False, 0, Nothing, 0
Doc.Extension.SelectByID2 "SketchText1", "SKETCHTEXT", 0, 0, 0, False, 0, Nothing, 0
Set text = SelMgr.GetSelectedObject6(1, -1)
Set format = text.GetTextFormat
format.CharHeight = Doc.Parameter("D1@Fillet3").SystemValue / 1.5
text.SetTextFormat False, format
Thanks Fifi Riri,
To be honest, I know that the macro "alone in a sub" works. But the idea is to create a Macro Feature who resizes the text
automatically each time I change the size of the srew (so, each time I rebuild the drawing).
I'm sorry but this is not practical. Macrofeatures are not meant to modify other features.
MacroFeatures are very unstable at times if you are not careful.
I have seen every possible problem that comes from MacroFeatures, well I hope there won't be any more. I have spent years debugging the solidworks side to find memory leaks on their end. Avoid them at all costs.
A better way is to use events.
Register to rebuildnotify.
Thanks for this information. I'm going to look for events.