Bonjour,
Ce message fait suite au premier pour lequel je demandais comment inserer
une commande de transfert FTP dans une macro.
La solution proposée par MichDenis convient parfaitement.
Le problème se pose ensuite lorsque je dois mettre en forme le fichier
texte récupéré. Cela plante car le fichier est toujours en cours de
transfert lorsque la procédure se pousuit (Traitement). Qulqu'un aurait-il
la solution à ce problème ?
Merci
Domi
Sub testTransfert()
'Importation du fichier txt
Shell "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt
192.x.x.x", vbNormalFocus 'vbHide
'''''Comment ne faire executer la suite qu'à la fin du transfert ? (lorque
la fenêtre de transfert se ferme....)
'Traitement du fichier txt
Workbooks.OpenText Filename:="C:TRANSFERTtoto.txt",
Origin:=xlWindows,StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, 2),
Array(25 , 2), Array(44, 2), Array(53, 1), Array(66, 1), Array(79,
1),Array(92, 9), Array(102, 4), Array(110, 9), Array(124, 2), Array(129,
2), Array(132, 9))
etc.....
End Sub
Bonjour,
Ce message fait suite au premier pour lequel je demandais comment inserer
une commande de transfert FTP dans une macro.
La solution proposée par MichDenis convient parfaitement.
Le problème se pose ensuite lorsque je dois mettre en forme le fichier
texte récupéré. Cela plante car le fichier est toujours en cours de
transfert lorsque la procédure se pousuit (Traitement). Qulqu'un aurait-il
la solution à ce problème ?
Merci
Domi
Sub testTransfert()
'Importation du fichier txt
Shell "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt
192.x.x.x", vbNormalFocus 'vbHide
'''''Comment ne faire executer la suite qu'à la fin du transfert ? (lorque
la fenêtre de transfert se ferme....)
'Traitement du fichier txt
Workbooks.OpenText Filename:="C:TRANSFERTtoto.txt",
Origin:=xlWindows,StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, 2),
Array(25 , 2), Array(44, 2), Array(53, 1), Array(66, 1), Array(79,
1),Array(92, 9), Array(102, 4), Array(110, 9), Array(124, 2), Array(129,
2), Array(132, 9))
etc.....
End Sub
Bonjour,
Ce message fait suite au premier pour lequel je demandais comment inserer
une commande de transfert FTP dans une macro.
La solution proposée par MichDenis convient parfaitement.
Le problème se pose ensuite lorsque je dois mettre en forme le fichier
texte récupéré. Cela plante car le fichier est toujours en cours de
transfert lorsque la procédure se pousuit (Traitement). Qulqu'un aurait-il
la solution à ce problème ?
Merci
Domi
Sub testTransfert()
'Importation du fichier txt
Shell "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt
192.x.x.x", vbNormalFocus 'vbHide
'''''Comment ne faire executer la suite qu'à la fin du transfert ? (lorque
la fenêtre de transfert se ferme....)
'Traitement du fichier txt
Workbooks.OpenText Filename:="C:TRANSFERTtoto.txt",
Origin:=xlWindows,StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, 2),
Array(25 , 2), Array(44, 2), Array(53, 1), Array(66, 1), Array(79,
1),Array(92, 9), Array(102, 4), Array(110, 9), Array(124, 2), Array(129,
2), Array(132, 9))
etc.....
End Sub
Copie tout ce qui suit dans un module standard :
'Section Variables et API dans le haut du module standard
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib _
"kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds _
As Long) As Long
Declare Function CreateProcessA Lib "kernel32" _
(ByVal lpApplicationName As Long, ByVal lpCommandLine As _
String, ByVal lpProcessAttributes As Long, ByVal _
lpThreadAttributes As Long, ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As Long, lpStartupInfo As _
STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) _
As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject _
As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Sub ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
start.cb = Len(start)
ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
End Sub
Et dans ta macro, tu passes la ligne suivante
'----------------------
ExecCmd Shell(" Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbNormalFocus 'vbHide")
'----------------------
Et le reste de ton code ici ....
"Domi" a écrit dans le message de news:
Bonjour,
Ce message fait suite au premier pour lequel je demandais comment inserer
une commande de transfert FTP dans une macro.
La solution proposée par MichDenis convient parfaitement.
Le problème se pose ensuite lorsque je dois mettre en forme le fichier
texte
récupéré. Cela plante car le fichier est toujours en cours de transfert
lorsque la procédure se pousuit (Traitement). Qulqu'un aurait-il la
solution
à ce problème ?
Merci
Domi
Sub testTransfert()
'Importation du fichier txt
Shell "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt
192.x.x.x", vbNormalFocus 'vbHide
'''''Comment ne faire executer la suite qu'à la fin du transfert ? (lorque
la fenêtre de transfert se ferme....)
'Traitement du fichier txt
Workbooks.OpenText Filename:="C:TRANSFERTtoto.txt",
Origin:=xlWindows,StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, 2),
Array(25 , 2), Array(44, 2), Array(53, 1), Array(66, 1), Array(79,
1),Array(92, 9), Array(102, 4), Array(110, 9), Array(124, 2), Array(129,
2), Array(132, 9))
etc.....
End Sub
Copie tout ce qui suit dans un module standard :
'Section Variables et API dans le haut du module standard
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib _
"kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds _
As Long) As Long
Declare Function CreateProcessA Lib "kernel32" _
(ByVal lpApplicationName As Long, ByVal lpCommandLine As _
String, ByVal lpProcessAttributes As Long, ByVal _
lpThreadAttributes As Long, ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As Long, lpStartupInfo As _
STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) _
As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject _
As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Sub ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
start.cb = Len(start)
ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
End Sub
Et dans ta macro, tu passes la ligne suivante
'----------------------
ExecCmd Shell(" Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbNormalFocus 'vbHide")
'----------------------
Et le reste de ton code ici ....
"Domi" <scrat83@free.fr> a écrit dans le message de news:
esG7Xx5FHHA.5104@TK2MSFTNGP03.phx.gbl...
Bonjour,
Ce message fait suite au premier pour lequel je demandais comment inserer
une commande de transfert FTP dans une macro.
La solution proposée par MichDenis convient parfaitement.
Le problème se pose ensuite lorsque je dois mettre en forme le fichier
texte
récupéré. Cela plante car le fichier est toujours en cours de transfert
lorsque la procédure se pousuit (Traitement). Qulqu'un aurait-il la
solution
à ce problème ?
Merci
Domi
Sub testTransfert()
'Importation du fichier txt
Shell "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt
192.x.x.x", vbNormalFocus 'vbHide
'''''Comment ne faire executer la suite qu'à la fin du transfert ? (lorque
la fenêtre de transfert se ferme....)
'Traitement du fichier txt
Workbooks.OpenText Filename:="C:TRANSFERTtoto.txt",
Origin:=xlWindows,StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, 2),
Array(25 , 2), Array(44, 2), Array(53, 1), Array(66, 1), Array(79,
1),Array(92, 9), Array(102, 4), Array(110, 9), Array(124, 2), Array(129,
2), Array(132, 9))
etc.....
End Sub
Copie tout ce qui suit dans un module standard :
'Section Variables et API dans le haut du module standard
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib _
"kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds _
As Long) As Long
Declare Function CreateProcessA Lib "kernel32" _
(ByVal lpApplicationName As Long, ByVal lpCommandLine As _
String, ByVal lpProcessAttributes As Long, ByVal _
lpThreadAttributes As Long, ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As Long, lpStartupInfo As _
STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) _
As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject _
As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Sub ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
start.cb = Len(start)
ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
End Sub
Et dans ta macro, tu passes la ligne suivante
'----------------------
ExecCmd Shell(" Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbNormalFocus 'vbHide")
'----------------------
Et le reste de ton code ici ....
"Domi" a écrit dans le message de news:
Bonjour,
Ce message fait suite au premier pour lequel je demandais comment inserer
une commande de transfert FTP dans une macro.
La solution proposée par MichDenis convient parfaitement.
Le problème se pose ensuite lorsque je dois mettre en forme le fichier
texte
récupéré. Cela plante car le fichier est toujours en cours de transfert
lorsque la procédure se pousuit (Traitement). Qulqu'un aurait-il la
solution
à ce problème ?
Merci
Domi
Sub testTransfert()
'Importation du fichier txt
Shell "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt
192.x.x.x", vbNormalFocus 'vbHide
'''''Comment ne faire executer la suite qu'à la fin du transfert ? (lorque
la fenêtre de transfert se ferme....)
'Traitement du fichier txt
Workbooks.OpenText Filename:="C:TRANSFERTtoto.txt",
Origin:=xlWindows,StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, 2),
Array(25 , 2), Array(44, 2), Array(53, 1), Array(66, 1), Array(79,
1),Array(92, 9), Array(102, 4), Array(110, 9), Array(124, 2), Array(129,
2), Array(132, 9))
etc.....
End Sub
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
Essaie ceci : La procédure Test()
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
' Initialisez la structure STARTUPINFO :
start.cb = Len(start)
' Démarrez l'application Shell :
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Attendez la fin de l'application Shell :
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
'------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd("C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt 192.x.x.x")
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" a écrit dans le message de news:
%23fY2D%
Bonjour,
Je met un peu de temps pour répondre parce je teste au boulot...
Je ne comprends pas, si je copie sans le moindre changement (à part lIP)
j'ai systématiquement un message d'erreur de syntaxe...
J'ai essayé un peu tout mais en vain ! le premier Shell que tu m'a proposé
marche pourtant impec mais ave le 2eme ça ne passe plus, je me doute que
ça
doit pas être grand chose mais je ne vois vraiment pas quoi.
As la possiblité de tester une telle procédure ?
MErci pour ton aide
Domi
"MichDenis" a écrit dans le message de news:
%
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
Essaie ceci : La procédure Test()
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
' Initialisez la structure STARTUPINFO :
start.cb = Len(start)
' Démarrez l'application Shell :
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Attendez la fin de l'application Shell :
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
'------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd("C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt 192.x.x.x")
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" <scrat83@free.fr> a écrit dans le message de news:
%23fY2D%23SGHHA.1248@TK2MSFTNGP03.phx.gbl...
Bonjour,
Je met un peu de temps pour répondre parce je teste au boulot...
Je ne comprends pas, si je copie sans le moindre changement (à part lIP)
j'ai systématiquement un message d'erreur de syntaxe...
J'ai essayé un peu tout mais en vain ! le premier Shell que tu m'a proposé
marche pourtant impec mais ave le 2eme ça ne passe plus, je me doute que
ça
doit pas être grand chose mais je ne vois vraiment pas quoi.
As la possiblité de tester une telle procédure ?
MErci pour ton aide
Domi
"MichDenis" <michdenis@hotmail.com> a écrit dans le message de news:
%23c5wjaIGHHA.4920@TK2MSFTNGP05.phx.gbl...
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
Essaie ceci : La procédure Test()
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
' Initialisez la structure STARTUPINFO :
start.cb = Len(start)
' Démarrez l'application Shell :
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Attendez la fin de l'application Shell :
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
'------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd("C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt 192.x.x.x")
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" a écrit dans le message de news:
%23fY2D%
Bonjour,
Je met un peu de temps pour répondre parce je teste au boulot...
Je ne comprends pas, si je copie sans le moindre changement (à part lIP)
j'ai systématiquement un message d'erreur de syntaxe...
J'ai essayé un peu tout mais en vain ! le premier Shell que tu m'a proposé
marche pourtant impec mais ave le 2eme ça ne passe plus, je me doute que
ça
doit pas être grand chose mais je ne vois vraiment pas quoi.
As la possiblité de tester une telle procédure ?
MErci pour ton aide
Domi
"MichDenis" a écrit dans le message de news:
%
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
Essaie ceci : La procédure Test()
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
' Initialisez la structure STARTUPINFO :
start.cb = Len(start)
' Démarrez l'application Shell :
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Attendez la fin de l'application Shell :
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
'------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd("C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt 192.x.x.x")
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" a écrit dans le message de news:
%23fY2D%
Bonjour,
Je met un peu de temps pour répondre parce je teste au boulot...
Je ne comprends pas, si je copie sans le moindre changement (à part lIP)
j'ai systématiquement un message d'erreur de syntaxe...
J'ai essayé un peu tout mais en vain ! le premier Shell que tu m'a proposé
marche pourtant impec mais ave le 2eme ça ne passe plus, je me doute que
ça
doit pas être grand chose mais je ne vois vraiment pas quoi.
As la possiblité de tester une telle procédure ?
MErci pour ton aide
Domi
"MichDenis" a écrit dans le message de news:
%
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
Essaie ceci : La procédure Test()
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
' Initialisez la structure STARTUPINFO :
start.cb = Len(start)
' Démarrez l'application Shell :
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Attendez la fin de l'application Shell :
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
'------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd("C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt 192.x.x.x")
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" <scrat83@free.fr> a écrit dans le message de news:
%23fY2D%23SGHHA.1248@TK2MSFTNGP03.phx.gbl...
Bonjour,
Je met un peu de temps pour répondre parce je teste au boulot...
Je ne comprends pas, si je copie sans le moindre changement (à part lIP)
j'ai systématiquement un message d'erreur de syntaxe...
J'ai essayé un peu tout mais en vain ! le premier Shell que tu m'a proposé
marche pourtant impec mais ave le 2eme ça ne passe plus, je me doute que
ça
doit pas être grand chose mais je ne vois vraiment pas quoi.
As la possiblité de tester une telle procédure ?
MErci pour ton aide
Domi
"MichDenis" <michdenis@hotmail.com> a écrit dans le message de news:
%23c5wjaIGHHA.4920@TK2MSFTNGP05.phx.gbl...
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
Essaie ceci : La procédure Test()
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
' Initialisez la structure STARTUPINFO :
start.cb = Len(start)
' Démarrez l'application Shell :
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Attendez la fin de l'application Shell :
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
'------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd("C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt 192.x.x.x")
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" a écrit dans le message de news:
%23fY2D%
Bonjour,
Je met un peu de temps pour répondre parce je teste au boulot...
Je ne comprends pas, si je copie sans le moindre changement (à part lIP)
j'ai systématiquement un message d'erreur de syntaxe...
J'ai essayé un peu tout mais en vain ! le premier Shell que tu m'a proposé
marche pourtant impec mais ave le 2eme ça ne passe plus, je me doute que
ça
doit pas être grand chose mais je ne vois vraiment pas quoi.
As la possiblité de tester une telle procédure ?
MErci pour ton aide
Domi
"MichDenis" a écrit dans le message de news:
%
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
et si tu modifies l'ancienne procédure par cette syntaxe ?
------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd(Shell "C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt
192.x.x.x",vbHide)
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" a écrit dans le message de news:
e%
Bonjour ;o),
Procédure testée.
Pas de plantage,
Apparition très furtive d'une fenêtre (la fenêtre DOS qui apparait
habituellement lors du transfert je suppose, mais aucun transfert ne se
fait) et affichage du message "Processus terminé code de sortie 2"
Ca fait avancer le schmilblic ?
Je n'avais pas préciser : Excel 2003 SP2 sous Windows XP Pro SP2
Merci
Domi
"MichDenis" a écrit dans le message de news:
%Essaie ceci : La procédure Test()
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
' Initialisez la structure STARTUPINFO :
start.cb = Len(start)
' Démarrez l'application Shell :
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Attendez la fin de l'application Shell :
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
'------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd("C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt 192.x.x.x")
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" a écrit dans le message de news:
%23fY2D%
Bonjour,
Je met un peu de temps pour répondre parce je teste au boulot...
Je ne comprends pas, si je copie sans le moindre changement (à part lIP)
j'ai systématiquement un message d'erreur de syntaxe...
J'ai essayé un peu tout mais en vain ! le premier Shell que tu m'a
proposé
marche pourtant impec mais ave le 2eme ça ne passe plus, je me doute que
ça
doit pas être grand chose mais je ne vois vraiment pas quoi.
As la possiblité de tester une telle procédure ?
MErci pour ton aide
Domi
"MichDenis" a écrit dans le message de news:
%
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
et si tu modifies l'ancienne procédure par cette syntaxe ?
------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd(Shell "C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt
192.x.x.x",vbHide)
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" <scrat83@free.fr> a écrit dans le message de news:
e%231PjlfGHHA.4688@TK2MSFTNGP04.phx.gbl...
Bonjour ;o),
Procédure testée.
Pas de plantage,
Apparition très furtive d'une fenêtre (la fenêtre DOS qui apparait
habituellement lors du transfert je suppose, mais aucun transfert ne se
fait) et affichage du message "Processus terminé code de sortie 2"
Ca fait avancer le schmilblic ?
Je n'avais pas préciser : Excel 2003 SP2 sous Windows XP Pro SP2
Merci
Domi
"MichDenis" <michdenis@hotmail.com> a écrit dans le message de news:
%2311BqgTGHHA.1240@TK2MSFTNGP03.phx.gbl...
Essaie ceci : La procédure Test()
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
' Initialisez la structure STARTUPINFO :
start.cb = Len(start)
' Démarrez l'application Shell :
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Attendez la fin de l'application Shell :
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
'------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd("C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt 192.x.x.x")
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" <scrat83@free.fr> a écrit dans le message de news:
%23fY2D%23SGHHA.1248@TK2MSFTNGP03.phx.gbl...
Bonjour,
Je met un peu de temps pour répondre parce je teste au boulot...
Je ne comprends pas, si je copie sans le moindre changement (à part lIP)
j'ai systématiquement un message d'erreur de syntaxe...
J'ai essayé un peu tout mais en vain ! le premier Shell que tu m'a
proposé
marche pourtant impec mais ave le 2eme ça ne passe plus, je me doute que
ça
doit pas être grand chose mais je ne vois vraiment pas quoi.
As la possiblité de tester une telle procédure ?
MErci pour ton aide
Domi
"MichDenis" <michdenis@hotmail.com> a écrit dans le message de news:
%23c5wjaIGHHA.4920@TK2MSFTNGP05.phx.gbl...
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")
et si tu modifies l'ancienne procédure par cette syntaxe ?
------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd(Shell "C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt
192.x.x.x",vbHide)
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" a écrit dans le message de news:
e%
Bonjour ;o),
Procédure testée.
Pas de plantage,
Apparition très furtive d'une fenêtre (la fenêtre DOS qui apparait
habituellement lors du transfert je suppose, mais aucun transfert ne se
fait) et affichage du message "Processus terminé code de sortie 2"
Ca fait avancer le schmilblic ?
Je n'avais pas préciser : Excel 2003 SP2 sous Windows XP Pro SP2
Merci
Domi
"MichDenis" a écrit dans le message de news:
%Essaie ceci : La procédure Test()
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
' Initialisez la structure STARTUPINFO :
start.cb = Len(start)
' Démarrez l'application Shell :
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Attendez la fin de l'application Shell :
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
'------------------------------------
Sub Test()
Dim retval As Long
retval = ExecCmd("C:WINDOWSsystem32ftp.exe -s
c:transferttransf.txt 192.x.x.x")
MsgBox "Le processus est terminé, code de sortie" & retval
End Sub
'------------------------------------
"Domi" a écrit dans le message de news:
%23fY2D%
Bonjour,
Je met un peu de temps pour répondre parce je teste au boulot...
Je ne comprends pas, si je copie sans le moindre changement (à part lIP)
j'ai systématiquement un message d'erreur de syntaxe...
J'ai essayé un peu tout mais en vain ! le premier Shell que tu m'a
proposé
marche pourtant impec mais ave le 2eme ça ne passe plus, je me doute que
ça
doit pas être grand chose mais je ne vois vraiment pas quoi.
As la possiblité de tester une telle procédure ?
MErci pour ton aide
Domi
"MichDenis" a écrit dans le message de news:
%
| ExecCmd Shell(" Shell
| "C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
Si tu observes la syntaxe suggérée de la ligne de code suggéré, tu
devrais avoir :
ExecCmd Shell("Shell
"C:WINDOWSsystem32ftp.exe -s:c:transferttransf.txt 192.x.x.x",
vbHide")