dim ligne as string open "c:\ton_chemin\ton_fichier.txt" for input as #1 do while not eof[1] line input #1,ligne if left(ligne,4)="URL=" then Label1.caption=mid(ligne,5) end if if left(ligne ,9)="IconFile=" then Label2.caption=mid(ligne,10) end if loop close #1
Dim urlStart As Long Dim urlEnd As Long Dim ma_var As String ma_var = "[DEFAULT]BASEURL=http://www.pcastuces.com/pratique/securite/spam/page1.htm[InternetShortcut]URL=http://www.pcastuces.com/pratique/securite/spam/page12.htmModified=8037303BD8C5C40184IconFile=http://www.pcastuces.com/favicon.icoIconIndex=1" ' <-- à remplir urlStart = InStr(1, ma_var, "URL=", vbTextCompare) urlStart = InStr(urlStart + 1, ma_var, "URL=", vbTextCompare) urlEnd = InStr(urlStart, ma_var, "Modified=", vbTextCompare) Label1.Caption = Mid(ma_var, urlStart + 4, urlEnd - urlStart - 4) urlStart = InStr(1, ma_var, "IconFile=", vbTextCompare) urlEnd = InStr(urlStart, ma_var, "IconIndex=", vbTextCompare) Label2.Caption = Mid(ma_var, urlStart + 9, urlEnd - urlStart - 9)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim ma_var as string 'ou ton texte sera stocké Dim boucle as integer Dim Tableau() Tableau=split(ma_var,vbcrlf) for boucle=0 to ubound(tableau) if left(tableau(boucle) ,4)="URL=" then Label1.caption=mid(tableau(boucle),5) end if if left(tableau(boucle) ,9)="IconFile=" then Label2.caption=mid(tableau(boucle),10) end if next boucle