Thanks!!
I think that code works on the CRichEditDoc class, but I have a CDocument class. I have tried to change my code to use CRichEditDoc instead of CDocument (by adding a view class and a cntr class) but then, when I execute the application, when I try to open a new document, the application crash in "OLELINK.CPP, in the line COleDocument::OnOpenDocument"
how can I solve this problem?