Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

OLE - Ouvrir un fichier TXT avec Notepad via VB

1 réponse
Avatar
Ingrid
Hello tout le monde,

Qqu'un pourrai me donner le code pour ouvrir un fichier txt avec notepad via
comme on fait pour excel dans le code ci-dessous.

Dim a As Object
Set a = CreateObject("Excel.Application")
With a
.Workbooks.Open "C:\TEST.xls"
End With


Merci d'avance

Ingrid

1 réponse

Avatar
ng
Salut,

Notepad n'est pas pilotable par automation, il faudtra utiliser un shell :

Call Shell("notepad """ & strDoc & """")

où strDoc est une chaine contenant le chemin complet du document.

Ou utiliser ShellExecute() qui ouvrira ton txt avec le prog par défaut (pas
forcément notepad) :

http://www.mentalis.org/apilist/ShellExecute.shtml

--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/