Open a text file in the system's default text edit

Started by nandagopal, Nov 17, 2008, 07:31 PM

Previous topic - Next topic

nandagopal

The program uses the ShellExecute API function to "open" the text file. The system looks up the default editor for that kind of file and opens the file with it. (This example assumes that the text box txtFile contains the name of a .txt file.)


Private Sub cmdOpen_Click()
    ShellExecute Me.hwnd, "open", txtFile.Text, _
        vbNullString, vbNullString, SW_SHOWMAXIMIZED
End Sub