Rebonjour
J'essai de voir si je peux "archiver" un fichier en suivant ceci
De 1 - est ce que ma logique est bonne?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 Sub Archive Set wshNetwork = CreateObject("Wscript.Network") strAnswer = window.prompt("Quel fichier rechercher?", "\\127.0.0.1\inventory\HTA\" & wshNetwork.ComputerName & ".xls") Set objFSO = CreateObject("Scripting.FileSystemObject") If objFSO.FileExists("\\127.0.0.1\inventory\HTA\" & wshNetwork.ComputerName & ".xls")Then intAnswer = _ Msgbox("Le fichier est bien présent...Voulez-vous archiver la fiche?", _ vbYesNo, "Move Files") If intAnswer = vbYes Then Dim oFSO Set oFSO = CreateObject("Scripting.FileSystemObject") oFSO.MoveFile "\\127.0.0.1\inventory\HTA\" & wshNetwork.ComputerName & ".xls","\\127.0.0.1\inventory\HTA\Archive\" & wshNetwork.ComputerName & "-Archive.xls" MsgBox "Fichier Archivé." Else Msgbox "Processus d'archive interrompu." End If Else MsgBox "Fichier non répertorié." End If End Sub
2- Le code est-il correct? (ça fonctionne outre le point 3)
3- Une erreur persiste si le fichier de destination (archive) est présent...devrais je faire un autre if FileExists?
Merci



Répondre avec citation








Ne pas oublier le tag
si satisfait.
pour encourager les intervenants.
Partager