在界面上放置一个opendialog,并设置好过滤,如opendialog1,用类似下面的代码:
if opendialog.execute
then olecontainer1.loadfromfile(opendialog1.filename);
说明:使用olecontaniner.loadfromfile和olecontraniler.loadfromstream可以载入指定的文档,这两个过程分别用于外部文件和数据流,但如果你装的是office97,那么其中的ole类好象只能打开和存储word8.0的文档。不能打开用word97写的文档,如打开将出现“read stream error”的错误。