https://pastebin.com/raw/YAYfZ99AHello. I have little trouble. Im really green in VBA but i know about it can be dont in VBA.
I have 2 folders with tons of txt
all txt have the same name in 2 folders but having another data.
ex.
Folder1/1.txt
Folder2/1.txt
Folder1/2.txt
Folder2/2.txt
Example Data files:
https://pastebin.com/raw/cvb0WZyR
https://pastebin.com/raw/1m0atp5G
I wanna from first file write 1 line value lastAccountName: In this is example is Pepek112
And from second file. This is long 1 line but i wanna value from "minecraftlay_one_minute". In this example, Value is 6840269
In a1 will be Pepek112 in A2 6840269
Im tried make something like this
But its not work with all filles because with my nick works great but with another make error
Example txt file which make error
https://pastebin.com/raw/YAYfZ99A
For first i got in A1 "Pepek112"
For second file i got in A1 "stAccoun"
I dont know how to loop all files and how to solve this :X
Regards
I have 2 folders with tons of txt
all txt have the same name in 2 folders but having another data.
ex.
Folder1/1.txt
Folder2/1.txt
Folder1/2.txt
Folder2/2.txt
Example Data files:
https://pastebin.com/raw/cvb0WZyR
https://pastebin.com/raw/1m0atp5G
I wanna from first file write 1 line value lastAccountName: In this is example is Pepek112
And from second file. This is long 1 line but i wanna value from "minecraftlay_one_minute". In this example, Value is 6840269
In a1 will be Pepek112 in A2 6840269
Im tried make something like this
Code:
Private Sub CommandButton1_Click()Dim myFile As String, text As String, textline As String, posName As String
myFile = "C:\Users\pepek\Downloads\userdata\dffc4b44-9be2-3ad5-878f-0a66f3df4982.txt"
Open myFile For Input As [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL]
Do Until EOF(1)
Line Input [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] , textline
text = text & textline
Loop
Close [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL]
posName = InStr(text, "lastAccountName")
Range("A1").Value = Mid(text, posLat + 18, 8)
End Sub
But its not work with all filles because with my nick works great but with another make error
Example txt file which make error
https://pastebin.com/raw/YAYfZ99A
For first i got in A1 "Pepek112"
For second file i got in A1 "stAccoun"
I dont know how to loop all files and how to solve this :X
Regards