Hey,
I need urgent help! So i am basically doing a macro that does this repeatedly with all the package names on a sheet:
1. Extracts from the same sheet a package name
2. Open a file with that package name + ".info" . These are text files with info on them
3. Gets the info "version" "popularity" etc. from the file and pastes it into the sheet on the same row but different column as the package name
I dont understand why it doesn't work. Checked everything but I still can't fix it.
Here I leave the code. Its pretty short.
CODE:
Sub Ad_block()
Dim package As String, MyFile As String, text As String, counter As Integer, posName As Integer, textline As String, posDescr As Integer, posPermission As Integer, posType As Integer, posVersion As Integer, posPopularity As Integer
counter = 1
For Each Cell In Range("F2:F11")
counter = counter + 1
package = ActiveCell.Value
MyFile = "/Volumes/Andrea_My_Passport/MASTER_THESIS/Analisis_Part_I/POPULAR_APPS/AD_BLOCKING/" & package & ".info"
Open MyFile For Input As #1
Do Until EOF(1)
Line Input #1, textline
text = text & textline
Loop
Close #1
posType = InStr(text, "category: ")
posVersion = InStr(text, "version: ")
posPopularity = InStr(text, "downloadsCountText: ")
posPermission = InStr(text, "permissionId: ")
posDescr = InStr(text, "description: ")
posName = InStr(text, "title: ")
Range("B" & counter).Value = Mid(text, posType + 11)
Range("D" & counter).Value = Mid(text, posVersion + 10)
Range("A" & counter).Value = Mid(text, posPopularity + 21)
Range("E" & counter).Value = Mid(text, posPermission + 11)
Range("G" & counter).Value = Mid(text, posType + 14, 100)
Range("C" & counter).Value = Mid(text, posName + 8)
Next Cell
End Sub
I have written this in Module 1. And ran it from there. Should I move it or put it somewhere else????
Thanks!!!!
Bookmarks