Isn't is possible to say something like:
If selection is nothing Then do nothing?
That way the Ribbon stays as is at the time when the cursor is placed between slides, which is OK.

ActiveWindow.ViewType = ppViewOutline
ActiveWindow.ViewType = ppViewNormal
When I put these two lines in the code (after Else), PowerPoint is flashing non-stop and crashes eventually
I removed the event WindowSelectionChange, because I thaught it was causing the problem, but it didn’t.

I tried the two options ppSelectionNone and ppSelectionSlides too.
With the ppSelectoinNone the tabgroup also disappears if I don’t have anything selected on the slide.
With ppSelectionSlides the run-time error appears too.

I now have this code:
[CODE]
'Callback for grpA / grpB / grpC getVisible
Sub GrpVisible(control As IRibbonControl, ByRef returnedVal)
    If Windows.Count = 0 Then
        returnedVal = False
  
 'In the slide sorter view I get the run-time error too, so I added this code. That works fine.
    ElseIf ActiveWindow.ActivePane.ViewType = ppViewSlideSorter Then
    returnedVal = False
   
    Else
        With ActiveWindow.Selection.SlideRange.Design
            Select Case control.Id
                Case "grpA"
                    returnedVal = (.Name = "TemplateA")
                Case "grpB"
                    returnedVal = (.Name = "TemplateB")
                Case "grpC"
                    returnedVal = (.Name = "TemplateC")
            End Select
        End With
    End If
   
    oRibbon.Invalidate
 
End Sub