sharepoint.bas 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. Option Compare Database
  2. Option Explicit
  3. Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
  4. "URLDownloadToFileA" ( _
  5. ByVal pCaller As Long, ByVal szURL As String, _
  6. ByVal szFileName As String, _
  7. ByVal dwReserved As Long, _
  8. ByVal lpfnCB As Long) As Long
  9. Sub DownloadFileFromWeb()
  10. Dim i As Integer
  11. Const strUrl As String = "http://backweb.bas-rhin.fr/perstein/parc-erstein/export/201407FISCHERAlain.xml"
  12. Dim strSavePath As String
  13. Dim returnValue As Long
  14. strSavePath = "C:\temp_\xml_2708.xml"
  15. returnValue = URLDownloadToFile(0, strUrl, strSavePath, 0, 0)
  16. End Sub
  17. Public Function testConnexionLecteur(ByVal lecteurVirtuel As String, ByVal repHttp As String) As Boolean
  18. On Error GoTo fin
  19. Dim essai As Integer
  20. Dim objFSO, objReseau As Object
  21. testConnexionLecteur = False
  22. Set objReseau = CreateObject("WScript.Network")
  23. If dir(lecteurVirtuel & "\", vbDirectory) <> "" Then
  24. 'déjà mappé
  25. Else
  26. objReseau.MapNetworkdrive lecteurVirtuel, repHttp
  27. End If
  28. testConnexionLecteur = True
  29. objReseau.RemoveNetworkDrive lecteurVirtuel, True
  30. fin:
  31. Set objReseau = Nothing
  32. End Function