Guus2005
AWF VIP
- Local time
- Today, 17:20
- Joined
- Jun 26, 2007
- Messages
- 2,641
I have this code to open a file with the default application based on the extension.
It is usually used for a .txt extension and it opened Notepad++.
It stopped working and i don't know why??
If anyone can tell me what's wrong with the code which i didn't change, why it stopped working or if you have an alternative, please let me know!
Thanks for your time.
It is usually used for a .txt extension and it opened Notepad++.
Code:
Public Sub openScriptInDefaultEditor(strFilename As String)
'File is opened in default editor
Dim strFullPath As String
Dim fso As Object
Set fso = CreateObject("Shell.Application")
strFullPath = Nz(DLookup("Pad", "tblScript", "Projectnaam = '" & TempVars!Projectnaam & "' and Scriptnaam = '" & strFilename& "'"), "")
If Len(strFullPath) > 0 Then
If FileExist(strFullPath) Then
fso.Open strFullPath
Else
MsgBox "File not found at location:" & vbCrLf & strFullPath, vbExclamation, "Oops"
End If
Else
MsgBox "Path is empty, no file found", vbExclamation, "???"
End If
End Sub
It stopped working and i don't know why??
If anyone can tell me what's wrong with the code which i didn't change, why it stopped working or if you have an alternative, please let me know!
Thanks for your time.