See in txt attached
for example:
ANPR_archivio_comuni.csv
comuni.csv
cap.csv
comuni_codici-catastali.csv
stemmi.csv
tks
extract only a .csv name file from url string
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
extract only a .csv name file from url string
You do not have the required permissions to view the files attached to this post.
-
- 4StarLounger
- Posts: 584
- Joined: 14 Nov 2012, 16:06
Re: extract only a .csv name file from url string
Adapt the path:
Code: Select all
Sub M_snb()
msgbox join(filter(split(replace(createobject("scripting.filesystemobject").opentextfile("G:\OF\nomefilecsv.txt).readall,vbcrlf,"/"),"/"),".csv"),vblf)
End Sub
-
- Administrator
- Posts: 78531
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: extract only a .csv name file from url string
If you prefer a loop:
Code: Select all
Sub Test()
Dim f As Integer
Dim all As String
Dim lines() As String
Dim i As Long
Dim parts() As String
Dim url As String
f = FreeFile
Open "C:\Test\nomefilecsv.txt" For Input As #f
all = Input(LOF(f), f)
Close #f
lines = Split(all, vbCrLf)
For i = 0 To UBound(lines)
parts = Split(lines(i), "/")
url = parts(UBound(parts))
Debug.Print url
Next i
End Sub
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
Re: extract only a .csv name file from url string
as usual you read my mind!HansV wrote: ↑01 Sep 2023, 10:51If you prefer a loop:
Code: Select all
Sub Test() Dim f As Integer Dim all As String Dim lines() As String Dim i As Long Dim parts() As String Dim url As String f = FreeFile Open "C:\Test\nomefilecsv.txt" For Input As #f all = Input(LOF(f), f) Close #f lines = Split(all, vbCrLf) For i = 0 To UBound(lines) parts = Split(lines(i), "/") url = parts(UBound(parts)) Debug.Print url Next i End Sub
work perfect!
Tks bro