VBA Excel récuperer nom de fichier via URL
Bonjour à tous !
j'aurai besoin d'un coup de main,
en fait je voudrais récupérer le nom d'un fichier de type .xls qui se trouve dans un serveur...
J'ai d'abord testé en local et cela marche parfaitement :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Sub test2()
Dim oFSO As Scripting.FileSystemObject
Dim oFl As Scripting.File
Dim strChemin As String
Set oFSO = New Scripting.FileSystemObject
strChemin = "D:\test\file.xls"
If oFSO.FileExists(strChemin) Then
Set oFl = oFSO.GetFile(strChemin)
MsgBox oFSO.GetBaseName(strChemin)
MsgBox oFSO.GetFileName(strChemin)
MsgBox oFSO.GetExtensionName(strChemin)
End If
End Sub |
Par contre, le fichier que je veux récupérer se trouve sous :
https://123456.com/dossier1/dossier2/file.xls
j'ai testé ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Sub test2()
Dim oFSO As Scripting.FileSystemObject
Dim oFl As Scripting.File
Dim strChemin As String
Set oFSO = New Scripting.FileSystemObject
strChemin = "https://123456.com/dossier1/dossier2/file.xls"
If oFSO.FileExists(strChemin) Then
Set oFl = oFSO.GetFile(strChemin)
MsgBox oFSO.GetBaseName(strChemin)
MsgBox oFSO.GetFileName(strChemin)
MsgBox oFSO.GetExtensionName(strChemin)
End If
End Sub |
mais cela ne marche pas un petit coup de main ?
Merci !