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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, _
ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileSectionNames Lib "kernel32.dll" Alias "GetPrivateProfileSectionNamesA" _
(ByVal lpszReturnBuffer As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Function EcritDansFichierIni(Section As String, Cle As String, Valeur As String, Fichier As String) As Long
EcritDansFichierIni = WritePrivateProfileString(Section, Cle, Valeur, Fichier)
End Function
Private Function LitDansFichierIni(Section As String, Cle As String, Fichier As String, _
Optional ValeurParDefaut As String = "") As String
Dim strReturn As String
strReturn = String(255, 0)
GetPrivateProfileString Section, Cle, ValeurParDefaut, strReturn, Len(strReturn), Fichier
LitDansFichierIni = Left(strReturn, InStr(strReturn, Chr(0)) - 1)
End Function
Private Function ListeSectionIni(ByVal Path As String, Section() As String)
Dim strReturn As String
strReturn = String(8192, 0)
GetPrivateProfileSectionNames strReturn, Len(strReturn), Path
Section = Split(Left(strReturn, InStr(1, strReturn, vbNullChar & vbNullChar) - 1), vbNullChar)
End Function
Sub IMPORTATION()
Dim Section() As String
i = 5
CHEMIN_INI = ThisWorkbook.Path
NAME_INI = CHEMIN_INI & "\ASSIST.ini"
ListeSectionIni "" & NAME_INI & "", Section '-- Paramètre Section passé ByRef
For Index = LBound(Section) To UBound(Section)
If Section(Index) <> "General" Then
Sheets("PILOTAGE").Cells(i, 2).Value = Section(Index)
Sheets("PILOTAGE").Cells(i, 1).Value = LitDansFichierIni(Section(Index), "UUID", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 3).Value = LitDansFichierIni(Section(Index), "DESIGNATION", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 4).Value = LitDansFichierIni(Section(Index), "10", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 5).Value = LitDansFichierIni(Section(Index), "20", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 6).Value = LitDansFichierIni(Section(Index), "30", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 7).Value = LitDansFichierIni(Section(Index), "40", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 8).Value = LitDansFichierIni(Section(Index), "50", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 9).Value = LitDansFichierIni(Section(Index), "60", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 10).Value = LitDansFichierIni(Section(Index), "70", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 11).Value = LitDansFichierIni(Section(Index), "80", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 12).Value = LitDansFichierIni(Section(Index), "90", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 13).Value = LitDansFichierIni(Section(Index), "100", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 14).Value = LitDansFichierIni(Section(Index), "110", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 15).Value = LitDansFichierIni(Section(Index), "120", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 16).Value = LitDansFichierIni(Section(Index), "130", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 17).Value = LitDansFichierIni(Section(Index), "140", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 18).Value = LitDansFichierIni(Section(Index), "150", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 19).Value = LitDansFichierIni(Section(Index), "160", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 20).Value = LitDansFichierIni(Section(Index), "?1", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 21).Value = LitDansFichierIni(Section(Index), "?2", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 22).Value = LitDansFichierIni(Section(Index), "?3", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 23).Value = LitDansFichierIni(Section(Index), "?4", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 24).Value = LitDansFichierIni(Section(Index), "?5", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 25).Value = LitDansFichierIni(Section(Index), "?6", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 26).Value = LitDansFichierIni(Section(Index), "ID", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 27).Value = LitDansFichierIni(Section(Index), "Mail", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 28).Value = LitDansFichierIni(Section(Index), "In", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 29).Value = LitDansFichierIni(Section(Index), "Out", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 30).Value = LitDansFichierIni(Section(Index), "Auto-Contrôle", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 31).Value = LitDansFichierIni(Section(Index), "Contrôle", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 32).Value = LitDansFichierIni(Section(Index), "Vérification", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 33).Value = LitDansFichierIni(Section(Index), "Surveillance", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 34).Value = LitDansFichierIni(Section(Index), "Avancement", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 35).Value = LitDansFichierIni(Section(Index), "Statut", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 36).Value = LitDansFichierIni(Section(Index), "?7", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 37).Value = LitDansFichierIni(Section(Index), "?8", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 38).Value = LitDansFichierIni(Section(Index), "?9", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 39).Value = LitDansFichierIni(Section(Index), "Modules communs", "" & NAME_INI & "", 100)
Sheets("PILOTAGE").Cells(i, 40).Value = LitDansFichierIni(Section(Index), "Stand-by", "" & NAME_INI & "", 100)
i = i + 1
Sheets("ACCUEIL").Range("E19").Value = (i - 5) / UBound(Section)
End If
Next
End Sub |
Partager