Sayyiduna Abu al-Rudayn (may Allah be pleased with him) narrates: The Prophet (peace and blessings be upon him) said: "Whenever some people gather together over the Book of Allah Almighty and teach it to one another, they are counted as the guests of Allah Almighty, and the angels surround them until they rise from their place or become engaged in some other conversation. Whenever a person goes out to acquire knowledge, fearing that this knowledge may depart, or copies that knowledge, fearing that it may be effaced, such a person is like one who goes out morning and evening in the path of Allah. And whoever is held back by his deeds, his lineage cannot hasten him forward."
Al-Tabarani recorded it in al-Mu'jam al-Kabir; its chain contains Isma'il bin Ayyash, about whose use as evidence there is disagreement.
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب العلم / 497