4
Contributors
3
Replies
5
Views
4 Years
Discussion Span
Last Post by tinstaafl
0

Hi,

Unless you have a reason to open it in a richtextbox you can open it directly like so:

Module Module1
    Sub Main()
    ' Open the file 'example.docx' at the current program's directory.
    ' It will appear in a new instance of word.
    Process.Start("example.docx")
    End Sub
End Module
0

when I used your codes I got error `

The system cannot find the file specified
 Sub Main()
        ' Open the file 'example.docx' at the current program's directory.
        ' It will appear in a new instance of word.
        Process.Start("D:\My CV\CV")
    End Sub


    Private Sub RichTextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox1.GotFocus
        Try
            Main()
        Catch err As Exception
            MsgBox(err.Message, MsgBoxStyle.Exclamation)
        End Try
    End Sub

`

0

Is your file named 'CV' or is it 'CV.docx'? You have to use the complete filename. The system uses the extension in the filename to determine which program to run.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.