Okette2:
If Mylevel.Name = NameLvl
Better use VB: Strcomp for text compare
Okette2:
ActiveSettings.Level = ActiveDesignFile.Levels(NameLvl)
You have to create the level within the levels object before setting it active.
From the VBA Help:"Whenever you change any aspect of a Level, you should subsequently call Levels.Rewrite to make the change permanent".