Massive stars in the solar neighbourhood and in external galaxies