Bonjour,

J'ai réalisé un programme sous excel 2010 qui fonctionne et je suis passé ensuite sous excel 2016

J'obtiens une erreur 70 permission refusée

Le programme est le suivant :

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Sub MAJ_Documents()
'Application.Cursor = xlWait
 
Const OverwriteExisting = True
 
If MAJ_Photos = 1 Then
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Supprime le répertoire en mode lecture
objFSO.DeleteFolder "D:\Datan\Ref_Articles\Documents"
' Recrée le répertoire pour ensuite copier les fichiers
MkDir "D:\Datan\Ref_Articles\Documents"
'objFSO.CopyFile "\\SOEVMFSC\VOL1\DATA\22-Logistique\09-Analyses_Methodes\09-Recherche_Stock\Documents\*.jpg", "D:\Datan\Ref_Articles\Documents", OverwriteExisting
 
Call VBCopyFolder("\\apps\data\35-Recherche_Stock\Documents\*.jpg", "D:\Datan\Ref_Articles\Documents")
 
'resp = MsgBox("Mise à jour terminée", vbInformation, "Mise à jour des photos terminées")
 
Unload MAJ_Ref
 
Else
 
'Const OverwriteExisting = True
'Set objFSO = CreateObject("Scripting.FileSystemObject")
'objFSO.CopyFile "\\SOEVMFSC\VOL1\DATA\22-Logistique\09-Analyses_Methodes\09-Recherche_Stock\Documents\*.jpg", "D:\Datan\Ref_Articles\Documents", OverwriteExisting
Call VBCopyFolder("\\apps\data\35-Recherche_Stock\Documents\*.jpg", "D:\Datan\Ref_Articles\Documents")
 
End If
 
 
 
Application.DisplayAlerts = True
Application.ScreenUpdating = True
 
MAJ_Photos = 0
'Application.Cursor = xlDefault
Set objFSO = Nothing
 
End Sub
le programme bloque à la ligne suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
objFSO.DeleteFolder "D:\Datan\Ref_Articles\Documents"

j'ai testé l'accès au répertoire, il n'y a pas de problème

Savez vous comment y remédier ?

Cordialement,