Un code que j'ai pas compris
Bonjour à tous,
bon ma demande est un peu débile mais bon le ridicule ne tue pas.En fait je suis novice en VB voir j'ai jamais fait du VB avant c'est pour ça j'ai besoi de comprendre le code suivant:
Code:
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
| Sub GetDataDemo()
Dim FilePath$, Row&, Column&, Address$
'change constants & FilePath below to suit
'***************************************
Const FileName$ = "exemple1.xls"
Const SheetName$ = "feuil1"
Const NumRows& = 10
Const NumColumns& = 10
FilePath = ActiveWorkbook.Path & "\"
'***************************************
DoEvents
Application.ScreenUpdating = False
If Dir(FilePath & FileName) = Empty Then
MsgBox "The file " & FileName & " was not found", , "File Doesn't Exist"
Exit Sub
End If
For Row = 1 To NumRows
For Column = 1 To NumColumns
Address = Cells(Row, Column).Address
Cells(Row, Column) = GetData(FilePath, FileName, SheetName, Address)
Columns.AutoFit
Next Column
Next Row
ActiveWindow.DisplayZeros = False
End Sub
Private Function GetData(Path, File, Sheet, Address)
Dim Data$
Data = "'" & Path & "[" & File & "]" & Sheet & "'!" & _
Range(Address).Range("A1").Address(, , xlR1C1)
GetData = ExecuteExcel4Macro(Data)
End Function |
Je sais que ce code nous permet de manipuler les données d'un fichier non ouvert,mais ce que j'arrive pas à comprendre c'est les "variable$" et "variable&" que j'arrive pas à trouver dans les tutoriaux.Aussi il y'a la partie:
Data = "'" & Path & "[" & File & "]" & Sheet & "'!" & _
Merci