Sub TestGetValue_2()
Dim P As String, F As String, S As String, A As String, R As Byte
Dim C As Byte
P = 'C:\\Documents and Settings\\Administrateur\\Mes documents'
F = 'classeur2.xls'
S = 'database'
Application.ScreenUpdating = False
For R = 1 To 100
For C = 1 To 3
A = Cells(R, C).Address
Cells(R, C) = GetValue(P, F, S, A)
Next C
Next R
Application.ScreenUpdating = True
End Sub
Private Function GetValue(Path, File, Sheet, Ref)
Dim Arg As String
'Vérie l'existence du fichier, ajoute les séparateurs manquants
If Right(Path, 1) <> '\\' Then Path = Path & '\\'
If Dir(Path & File) = '' Then
GetValue = 'File Not Found'
Exit Function
End If
'Crée l'argument ''D:\\mesdocuments\\loisirs\\[vacances.xls]Méribel'!R4C3'
Arg = ''' & Path & '[' & File & ']' & Sheet & ''!' & Range(Ref) _
.Range('A1').Address(, , xlR1C1)
'Exécute la macro XLM
GetValue = ExecuteExcel4Macro(Arg)
End Function