请问如何使VB程序能打开一个DOC文件。即:点击窗体上的按钮自动打开程序目录下的某WORD文档?
用Shell能实现吗?还是有什么其它方法?
谢谢!

解决方案 »

  1.   

    private sub cmdviewdata_clike()
        dim readtext as string
        open "文件相对路径" for input as #1
        while not eof(1)
            line input #1,readtext
            txtfiletext.text=txtfiletext.text & readtext & vbcrlf
        wend
        close #1
    end sub
      

  2.   

    private sub cmdviewdata_clike()
        dim readtext as string
        open "文件相对路径" for input as #1
        while not eof(1)
            line input #1,readtext
            txtfiletext.text=txtfiletext.text & readtext & vbcrlf
        wend
        close #1
    end sub
      

  3.   

    楼上的朋友,你这种方法只能在控件中显示文件的内容吧?我希望点击按钮时能够启动WORD打开那个文件,这样的话该怎么办?
    谢谢!
      

  4.   

    用shell,如下面,你自己改下路径和文件名.
    Shell "rundll32.exe url.dll,FileProtocolHandler " & App.Path & "\www.doc", vbMinimizedNoFocus