Bonjour,
Je souhaites faire une lecture d'un fichier excel tout en le gardant fermé.
J'ai donc utilisé des bouts de code trouvé sur le forum :
Quand le fichier est en local tout fonctionne correctement, par contre quand j'ouvre le même fichier mais en réseau il s'ouvre dans Excel...
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 Fichier = "cheminfichier\monfichier.xlsm" Feuille = "Mafeuille$" Cellule = "A1:AZ25000" Set Source = New ADODB.Connection Source.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _ "Data Source=" & Fichier & ";Extended Properties=""Excel 12.0 Macro;HDR=NO;IMEX=1;"";" Set ADOCommand = New ADODB.Command With ADOCommand .ActiveConnection = Source .CommandText = "SELECT * FROM [" & Feuille & Cellule & "]" End With Set Rst = New ADODB.Recordset Rst.Open ADOCommand, , adOpenKeyset, adLockOptimistic Set Rst = Source.Execute("[" & Feuille & Cellule & "]") FeuilleR.Cells(1, 1).CopyFromRecordset Rst Rst.Close Source.Close Set Source = Nothing Set Rst = Nothing Set ADOCommand = Nothing
Savez vous d'où peut venir ce "bug"?
D'avance merci,
Partager