Open a file using software in vbs

Solved
ElexXVII Posted messages 46 Status Membre -  
ElexXVII Posted messages 46 Status Membre -
Hello CCM,
I would like to know if it is possible to open a file using a software, I already know:
Dim Sh 
Set Sh = CreateObject("WScript.Shell")
Sh.Run "text.txt"
Set Sh = Nothing
But is it possible to choose (in the program) the software to use to open it? (For example, to open it with Notepad++ instead of Notepad).

Thank you in advance for your answers :D

1 réponse

cs_Le Pivert Posted messages 8437 Status Contributeur 730
 
Hello,

like this:

Dim shell As Object, path As String Set shell = CreateObject("WScript.Shell") path = "C:\Users\....\Documents\myfile.txt" 'adapt the path shell.Run "Notepad " & path


--
@+ The Woodpecker
1
ElexXVII Posted messages 46 Status Membre 1
 
You're welcome!
1