The investment Microsoft famously made in Apple in 1997 did not prevent Apple from going bankrupt. By the time the money was in Apple's accounts, its fortunes were already reversed.
The fact Microsoft announced they were investing, and that they were committed to continue shipping Office to Mac, definitely helped.