This is a matter of debate under the 22nd amendment:
There is some debate about how this amendment works with the 12th Amendment. The 12th Amendment limits who can become Vice-President to only people who meet the requirements of being President. The central question in this debate is whether the 22nd Amendment is imposing requirements on eligibility for holding the office of President or if it is merely imposing requirements on being elected to the office of President.
One side of the debate argues that the 22nd Amendment explicitly uses the language "No person shall be elected" and is therefore issuing guidance on elections. The existence of other means of assuming the office (as enumerated in the 20th Amendment, Section 3 and the 25th Amendment) lends support to this argument.
The other side of the debate argues that the 12th Amendment, in describing how elections are to be carried out, is enumerating additional requirement for holding the office of President. In support of this side of the argument is the fact that the requirements for holding the office of President are not restricted to Article 2 (where the main requirements like age and citizenship are listed). For example, impeachment is described in Article 1, Section 3 and upon impeachment, conviction, and removal from office a person becomes ineligible to hold the office in the future. Similarly, the 14th Amendment establishes a requirement that a President must not have fought against the United States or given aid and comfort to its enemies. These amendments suggest a pattern of enumerating additional requirements for the presidency and proponents of this side of the debate would argue that the 22nd Amendment was intended to add yet another requirement.
Since no president who has served two terms has ever tried to be vice-president, this situation has not yet been decided by the courts.
So, why don't you try it and we can find out?