code vba ActiveWorkbook.CheckCompatibility = False à insérer

SEBELEC16

XLDnaute Nouveau
Bonjour à tous,

j'aimerais insérer ce code ActiveWorkbook.CheckCompatibility = False dans la macro suivante :

mais je ne sais pas ou l'intégrer pour qu'il fonctionne.

Sub essai()
Dim fs, f, f1, fc, s
Dim a(26)
Application.ScreenUpdating = False
specdossier = RepIni(ActiveWorkbook.Path)
If specdossier = "" Then Exit Sub
fic = ActiveWorkbook.Name
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(specdossier)
Set fc = f.Files
pos = 15
For Each f1 In fc
s = f1.Name
b = Right(s, 3)
If b = "xls" And s <> ActiveWorkbook.Name Then
ActiveSheet.Unprotect ("123")
Workbooks.Open Filename:=specdossier & "\" & s
Sheets("FV").Activate
a(1) = Cells(15, 1)
a(5) = Cells(15, 5)
a(7) = Cells(15, 7)
a(11) = Cells(15, 11)
a(15) = Cells(15, 15)
a(20) = Cells(15, 21)
a(22) = Cells(15, 26)
a(23) = Cells(15, 22)
a(24) = Cells(15, 24)
ActiveWorkbook.Close
Windows(fic).Activate
Sheets("FV").Activate
For u = 1 To 26
Cells(pos, u) = a(u)

Next u
pos = pos + 1
End If
Next
ActiveSheet.Protect ("123")

End Sub
Function RepIni(Defaut As String)
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Filters.Clear
.Title = "Selectionner le répertoire de départ"
.InitialFileName = Defaut
If .Show = -1 Then
RepIni = fd.SelectedItems(1)
End If
End With
Set fd = Nothing
End Function

merci d'avance pour votre aide.

cordialement

sebelec
 

Pierrot93

XLDnaute Barbatruc
Re : code vba ActiveWorkbook.CheckCompatibility = False à insérer

Bonjour,

essaye peut être ceci, à placer avant l'enregistrement du classeur ou sa fermeture :
Code:
If CDbl(Application.Version) > 11 Then ActiveWorkbook.CheckCompatibility = False

bonne journée
@+
 

Discussions similaires

Réponses
6
Affichages
235

Membres actuellement en ligne

Statistiques des forums

Discussions
312 177
Messages
2 085 972
Membres
103 073
dernier inscrit
MSCHOE16