Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Raymond [mvp]
Bonsoir.
tu peux passer par la méthode open, readall / readline, write / writeline, close qui ne sont pas du tout des commandes Access mais que access accepte encore d'exécuter. tu peux passer par un objet Scripting Runtime dont tu trouveras la documentation sur : http://officesystem.access.free.fr/scr_scripting_runtime.htm tu peux passer aussi par une commande Shell pour lancer tout fichier exécutable
-- @+ Raymond Access MVP http://OfficeSystem.Access.free.fr/ Pour débuter sur le forum: http://www.mpfa.info/
Le multimédia vu par Windows Vista, Office 2007 et Windows Live !!! http://www.comscamp.com/Tracker/Redirect.ashx?linkid°64304e-439a-45c7-9d2f-c3326db58273
"Thierry" a écrit dans le message de news:
| Bonjour, | | Est-il possible, à partir d'Access (VBA), de copier les données d'un | fichier .txt à la suite des données d'un autre fichier .txt ? | | (comme la commande Dos : more fichier1.txt >> fichier2.txt ) | | Merci et bonne soirée. | Thierry | |
Bonsoir.
tu peux passer par la méthode open, readall / readline, write / writeline,
close qui ne sont pas du tout des commandes Access mais que access accepte
encore d'exécuter.
tu peux passer par un objet Scripting Runtime dont tu trouveras la
documentation sur :
http://officesystem.access.free.fr/scr_scripting_runtime.htm
tu peux passer aussi par une commande Shell pour lancer tout fichier
exécutable
--
@+
Raymond Access MVP http://OfficeSystem.Access.free.fr/
Pour débuter sur le forum: http://www.mpfa.info/
Le multimédia vu par Windows Vista, Office 2007 et Windows Live !!!
http://www.comscamp.com/Tracker/Redirect.ashx?linkid°64304e-439a-45c7-9d2f-c3326db58273
"Thierry" <th.tg@laposte.net> a écrit dans le message de news:
ACA9918F-370C-408C-A60B-A10F9BC43983@microsoft.com...
| Bonjour,
|
| Est-il possible, à partir d'Access (VBA), de copier les données d'un
| fichier .txt à la suite des données d'un autre fichier .txt ?
|
| (comme la commande Dos : more fichier1.txt >> fichier2.txt )
|
| Merci et bonne soirée.
| Thierry
|
|
tu peux passer par la méthode open, readall / readline, write / writeline, close qui ne sont pas du tout des commandes Access mais que access accepte encore d'exécuter. tu peux passer par un objet Scripting Runtime dont tu trouveras la documentation sur : http://officesystem.access.free.fr/scr_scripting_runtime.htm tu peux passer aussi par une commande Shell pour lancer tout fichier exécutable
-- @+ Raymond Access MVP http://OfficeSystem.Access.free.fr/ Pour débuter sur le forum: http://www.mpfa.info/
Le multimédia vu par Windows Vista, Office 2007 et Windows Live !!! http://www.comscamp.com/Tracker/Redirect.ashx?linkid°64304e-439a-45c7-9d2f-c3326db58273
"Thierry" a écrit dans le message de news:
| Bonjour, | | Est-il possible, à partir d'Access (VBA), de copier les données d'un | fichier .txt à la suite des données d'un autre fichier .txt ? | | (comme la commande Dos : more fichier1.txt >> fichier2.txt ) | | Merci et bonne soirée. | Thierry | |
pgz
Bonsoir.
Tu devrais trouver ce dont tu as besoin dans les méthodes de la bibliothèque : windows script host object model (IwshRuntimeLibrary) et tous particulièrement la classe file system object.
voici 2 exemples : Public Function fctLireFichierTxt(ByVal sPath As String) As String 'lit le fichier en entier dans une seule chaîne Dim fso As IWshRuntimeLibrary.FileSystemObject Dim fFile As IWshRuntimeLibrary.File Dim ts As IWshRuntimeLibrary.TextStream Dim s As String
Set fso = New IWshRuntimeLibrary.FileSystemObject Set fFile = fso.GetFile(sPath) Set ts = fFile.OpenAsTextStream(ForReading)
ts.Close Set ts = Nothing Set fFile = Nothing Set fso = Nothing End Function
'Ajouter une ligne : Public Sub subAjouterLigneFichierTxt(ByVal sPath As String, ByVal sTexte As String) Dim fso As IWshRuntimeLibrary.FileSystemObject Dim fFile As IWshRuntimeLibrary.File Dim ts As IWshRuntimeLibrary.TextStream
Set fso = New IWshRuntimeLibrary.FileSystemObject Set fFile = fso.GetFile(sPath) Set ts = fFile.OpenAsTextStream(ForAppending)
ts.WriteLine sTexte
ts.Close Set ts = Nothing Set fFile = Nothing Set fso = Nothing End Sub
Bon courage -- pgz _____________________________
Bonsoir.
Tu devrais trouver ce dont tu as besoin dans les méthodes de la bibliothèque :
windows script host object model (IwshRuntimeLibrary)
et tous particulièrement la classe file system object.
voici 2 exemples :
Public Function fctLireFichierTxt(ByVal sPath As String) As String
'lit le fichier en entier dans une seule chaîne
Dim fso As IWshRuntimeLibrary.FileSystemObject
Dim fFile As IWshRuntimeLibrary.File
Dim ts As IWshRuntimeLibrary.TextStream
Dim s As String
Set fso = New IWshRuntimeLibrary.FileSystemObject
Set fFile = fso.GetFile(sPath)
Set ts = fFile.OpenAsTextStream(ForReading)
ts.Close
Set ts = Nothing
Set fFile = Nothing
Set fso = Nothing
End Function
'Ajouter une ligne :
Public Sub subAjouterLigneFichierTxt(ByVal sPath As String, ByVal sTexte As
String)
Dim fso As IWshRuntimeLibrary.FileSystemObject
Dim fFile As IWshRuntimeLibrary.File
Dim ts As IWshRuntimeLibrary.TextStream
Set fso = New IWshRuntimeLibrary.FileSystemObject
Set fFile = fso.GetFile(sPath)
Set ts = fFile.OpenAsTextStream(ForAppending)
ts.WriteLine sTexte
ts.Close
Set ts = Nothing
Set fFile = Nothing
Set fso = Nothing
End Sub
Tu devrais trouver ce dont tu as besoin dans les méthodes de la bibliothèque : windows script host object model (IwshRuntimeLibrary) et tous particulièrement la classe file system object.
voici 2 exemples : Public Function fctLireFichierTxt(ByVal sPath As String) As String 'lit le fichier en entier dans une seule chaîne Dim fso As IWshRuntimeLibrary.FileSystemObject Dim fFile As IWshRuntimeLibrary.File Dim ts As IWshRuntimeLibrary.TextStream Dim s As String
Set fso = New IWshRuntimeLibrary.FileSystemObject Set fFile = fso.GetFile(sPath) Set ts = fFile.OpenAsTextStream(ForReading)
ts.Close Set ts = Nothing Set fFile = Nothing Set fso = Nothing End Function
'Ajouter une ligne : Public Sub subAjouterLigneFichierTxt(ByVal sPath As String, ByVal sTexte As String) Dim fso As IWshRuntimeLibrary.FileSystemObject Dim fFile As IWshRuntimeLibrary.File Dim ts As IWshRuntimeLibrary.TextStream
Set fso = New IWshRuntimeLibrary.FileSystemObject Set fFile = fso.GetFile(sPath) Set ts = fFile.OpenAsTextStream(ForAppending)
ts.WriteLine sTexte
ts.Close Set ts = Nothing Set fFile = Nothing Set fso = Nothing End Sub