Hallo,

der von herberto geposteten code (nochmals vielen Dank!) traten bei mir teilweise Laufzeitfehler auf, welche zur Folge hatten, dass ZenOn beendet wurde.
Erst ein explizites Freigeben des Rezeptobjektes in der Schleife behebt bei mir den Fehler.

Public Sub ExecuteLastRecipe()
On Error GoTo Exception
  Logger.logDebug "> ExecuteLastRecipe()", MODULE_NAME
  
  Dim obRecipeGroups As RGMRecipeGroups
  Dim obRecipeGroup As RGMRecipeGroup
  Dim obRecipe As RGMRecipe
  Dim obVariable As Variable
   
  Dim iRGroup As Integer
  Dim iRecipe As Integer
 
    'create a object of the variable which contains the last written Recipe
    'via systemvariable allocated to internal variable (set to remanent)
    Set obVariable = thisProject.Variables.Item("str_RecipeName")
    
    'check if the variable exists
    If obVariable Is Nothing Then
        Logger.logError "can not access variable to read last loaded recipe...", MODULE_NAME
        Exit Sub
    End If
 
    'check if the variable is advised (necessary for reading via VBA)
    If Not obVariable.IsOnline Then
        Logger.logError obVariable.Name & " is not advised for reading!", MODULE_NAME
        Exit Sub
    End If
 
    Set obRecipeGroups = thisProject.RGMGroups
    'loop through all RecipeGroups
    For iRGroup = 0 To obRecipeGroups.Count - 1
        Set obRecipeGroup = obRecipeGroups.Item(iRGroup)
        If Not obRecipeGroup Is Nothing Then
            'loop through all recipes within the given RecipeGroup
            For iRecipe = 0 To obRecipeGroup.RecipeCount - 1
                Logger.logDebug "Recipegroup " + CStr(iRecipe) + " ...", MODULE_NAME
                Set obRecipe = obRecipeGroup.RecipeItem(iRecipe)
                If Not obRecipe Is Nothing Then
                    'check if the name of the recipe matches the value of the variable
                    If obRecipe.DynProperties("RecipeName") = obVariable.value Then
                        'yes -> this is the correct one ... so do your actions with this recipe
                        'i.e. execute
                        obRecipe.Execute
                        Logger.logDebug "Rezepte '" + obRecipe.DynProperties("RecipeName") + "' ausgeführt.", MODULE_NAME
                    End If
                End If
                ' Objekt muss explizit freigegeben werden
                Set obRecipe = Nothing
            Next iRecipe
        End If
    Next iRGroup
  Logger.logDebug "< ExecuteLastRecipe()", MODULE_NAME
  
  Exit Sub
  
Exception:
  Logger.logError "Fehler beim Laden des letzten Rezeptes. Err. Number: " & CStr(Err.Number) & _
    " | Desc: " & Err.Description & " | Err. Source: " + Err.Source, MODULE_NAME
  Dim errMsg As String
  errMsg = thisProject.String("@err.loadRecipe")
  MsgBox errMsg, vbCritical, thisProject.String("@err.generalTitle")
End Sub