I have a macro which searches a directory to see if a text file exists. If that file exists the user is then given an option of whether they wish to veiw the file. My code runs fine, except I don't know what command to use to open the text file in an outside program such as Notepad.
Here's the code which checks for existence and then shoudl open the file.
I bolded the line at which I'm having trouble. I don't get an error message as it is a valid command, it just doesn't do what I need it to do. Does anyone know what command I should be using? I browsed the help files and could find anything that would do what I'm wanting to do.
Here's the code which checks for existence and then shoudl open the file.
Code:
'Checks for comments file
MainPath = "P:\DATA\test_files"
Set fs = CreateObject("Scripting.FileSystemObject")
Set fold = fs.GetFolder(MainPath)
Set f = fold.fileS
FilePath = MainPath & "\comments.txt"
If fs.FileExists(FilePath) = True Then
Response = MsgBox("Comments file found. Do you wish to view the file?", vbYesNo, "Commment File")
If Response = vbYes Then
[b]fs.OpenTextFile (FilePath)[/b]
End If
End If
I bolded the line at which I'm having trouble. I don't get an error message as it is a valid command, it just doesn't do what I need it to do. Does anyone know what command I should be using? I browsed the help files and could find anything that would do what I'm wanting to do.