Can. 927 It is absolutely forbidden, even in extreme urgent necessity, to consecrate one matter without the other or even both outside the eucharistic celebration.
By quoting this you actually refute your own case, and confirm mine - that it is
possible for consecration to occur "outside the eucharistic celebration" (or "outside the Mass", as the 1917 Code says).
Neither of the codes says "attempt to consecrate" or a similar expression which would denote a failure to effect the sacrament. Both simply say that
it is forbidden to consecrate outside the Mass, by which they are implicitly admitting that such a consecration would be valid (but gravely illicit).
P.S. In the 1917 Code it is Canon 817.