VBA to return FileDateTime for a file on Sharepoint

DanHaines

New Member
Joined
Feb 4, 2020
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hi all, I'm new here so apologise if there's any specific formatting I've missed.
To give a run down of what I'm trying to do;

We have a powerpoint running 24/7 which displays live and updated date which is retrieved through VBA.
There are some aspects to this which are updated on a manual basis so I have a userform which pulls a file from our sharepoint site, updates it, and saves it.

My code for the powerpoint runs for the slide onChange event. I currently download the file and check the current data in the workbook vs the old, if there's any changes I update the values on the powerpoint.

However what I'm after is a way to check the last modified time for the file before downloading, this way it will significantly reduce the amount of times it requires downloading.

I've yet to find a working solution, or at least one I've been able to implement.

TL;DR - I want to be able to return the last modified time for a file in Sharepoint.
I've tried all of the following:

VBA Code:
Const URL1 As String = "\\companName.sharepoint.com\sites\siteName\Shared Documents\fileName.xlsx"
Const URL2 As String = "//companName.sharepoint.com/sites/siteName/Shared Documents/fileName.xlsx"
Const URL3 As String = "https://companName.sharepoint.com/sites/siteName/Shared Documents/fileName.xlsx"

Debug.Print FileDateTime(URL1)
Debug.Print FileDateTime(URL2)
Debug.Print FileDateTime(URL3)

URL1 & 2 times out and gives me; Run-time error '5': Incalid procedure call or argument
URL3 is instant and doesn't even timeout, but gives me the same error.

Any help is much appreciated.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Did you ever get an answer to this?

I, also, need to retrieve file dates from SharePoint.
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,630
Members
449,041
Latest member
Postman24

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