Forum Discussion
CodeCarpenter
Apr 25, 2025Copper Contributor
Sharepoint Sync-On-Demand & Application.Path
A few years back I traced some weird VBA Macro code behavior in Excel back to a SharePoint feature called "Sync-On-Demand". When Sync-On-Demand is turned on, the VBA code "Application.Path" no longer returns the actual file location, and starts returning a SharePoint site. It does these without any warning and as far as I can tell there is no documentation about this.
This broke my companies primary management software until I traced it down and turned off Sync-On-Demand for my remote users. As of this week, the Sync-On-Demand option is not only gone from the Settings, but it seems to be secretly turned back on in the background as well.
If we weren't inspecting values after the code crashed, we would not even know this is happening. This means that right now anyone who is using SharePoint and thinks they are opening a local file, is actually opening a web location without even being told about it in any visible way. And it's being done through some sort of background hackery. It's shady as F.
We have opened a support ticket but so far they don't even seem to know they have done this and are pointing to new settings locations, but those do not yet exist for us.
- Is there anyone here with knowledge of this issue and some way for us to turn the sneaky Sync-On-Demand off as of today? The new help docs provided to us show a Conext Menu option available from an Explorer window, but that option does not exist for us.
- Does anyone know a way to get the file location of whatever Excel file is running a VBA Macros? Application.Path is supposed to be that, but I need a new way that actually works to return the actual harddrive path location, not the SharePoint location.
3 Replies
Sort By
How about to utilize ThisWorkbook.FullName or ThisWorkbook.Path within your VBA code. These properties typically provide the actual file path, even when the file is locally synced through OneDrive or SharePoint.
- CodeCarpenterCopper Contributor
My earlier respone to this disapeared a day later, so hopefully this one sticks around...
I mistakenly wrote "Application.Path" in my initial post - my code actually does already use "ThisWorkbook.Path" and that is what is returning the SharePoint site instead of the expected local file path. This only happens while Sync-On-Demand is enabled, but now it happens always since there is no user-available method of turning it off.
- CodeCarpenterCopper Contributor
My apologies - I mistyped my post as "Application.Path" instead of "ThisWorkbook.Path" which is what I am actually using.
ThisWorkbook.Path is returning the SharePoint location, despite opening the file from the HD location. I suspect they are using some sort of Symlink type shenanigans behind the scenes to accomplish (the now hidden) Sync-On-Demand functionality, despite the fact that I specifically do not want this functionality - and it is also breaking my critical business applications in unexpected and undocumented ways.