Downloading most recent file in sharepoint site

Damian37

Active Member
Joined
Jun 9, 2014
Messages
301
Office Version
  1. 365
Hello all,
I've managed to create code that will open a specific sharepoint site, however, I'm now attempting to open the most recent file unsuccessfully. I was hoping someone may have in to this situation before. Here;'s the code to open the site:
VBA Code:
Sub sbVBA_To_Open_Website_URL_FollowHypderlink()
    Dim strURL As String
    strURL = "https://comcastcorp.sharepoint.com/sites/XMSC/Shared%20Documents/Forms/AllItems.aspx?RootFolder=%2Fsites%2FXMSC%2FShared%20Documents%2FXPO%20Reporting%2FComcast%2FHourly%20Inventory%20On%20Hands&FolderCTID=0x01200030B083755A4E5A49946BDA920EC6FE37"
    ThisWorkbook.FollowHyperlink (strURL)
End Sub

Now that I have to site open I would like to download the most recent in order to manipulate it to suit my needs? Thanks for any help anyone can give me.


D.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Can anyone tell me why the first two lines of this code are red:
VBA Code:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
    ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Function DownloadFileFromWeb(strURL As String, strSavePath As String) As Long
    ' strSavePath includes filename
    DownloadFileFromWeb = URLDownloadToFile(0, strURL, strSavePath, 0, 0)
End Function

The code looks normal on this forum, however within the developer page shows the Private Declare Function thru to As Long, _ as red. Any ideas?

Thank you
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top