Added a function while opens existing text documents