Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
Not applicable

download excel file from share point


I want to download latest excel file from share point to local folder path using VBscript.

I have the VBscript code it is down loading current month file if it is present,that is this month file it is downloading if it present in share point but i want to download latest file upload in share point.

Ex: my file formate is :

10_2014 Filename.xlsx...etc..

if they uploaded 12_2014 Filename.xlsx file then i want to download this file.

i am using following code but it is downloading current month file:

Sub DownloadFile

'Identifying the latest Security file'

latestDate = Date

strYear = Year(latestDate)

strMonth = Right("0" & Month(latestDate), 2)

fileName = strMonth&"_"&strYear&" Filename.xlsx"

'strMonth&"_"&strYear&" Filename.xlsx"'

SharePointURL = "http://sharepointpath"

Current Month Data Load File/"&fileName

Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")

WinHttpReq.Open "GET", SharePointURL, False, "username", "password"


SharePointURL = WinHttpReq.responseBody

If WinHttpReq.Status = 200 Then

    Set oStream = CreateObject("ADODB.Stream")


    oStream.Type = 1

    oStream.Write WinHttpReq.responseBody

    oStream.SaveToFile "folderpath\"&fileName, 1 ' 1 = no overwrite, 2 = overwrite


End If

End Sub