Sayyiduna Ali (may Allah be pleased with him) narrates that I used to present myself before the Prophet (peace and blessings of Allah be upon him). If the Prophet (peace be upon him) was standing and performing prayer at that time, he would say "Subhan Allah," and if he was not performing prayer at that time, he would grant permission as it was (and there would be no need to say Subhan Allah).