VBA vs OneDrive: is it possible to use "Copy Link"s to work with files/folders?

Eugene Z 20 Reputation points
2025-06-18T14:10:11.63+00:00

VBA Word "Documents.Open" and "Document.SaveAs2" works with local files;

but when OneDrive is present - they can also work with network path, like

https://companyname.sharepoint.com/sites/ap/Shared%20Documents/Some%20Report/tstFo/1.xlsx

Problem: we are dealing with filename-length limitation of 255 chars, and the network paths are not much shorter (if not longer) than the local paths.

There is another way to identify a file or a folder on OneDrive - you can get it's "Copy Link", which looks like this:

https://companyname.sharepoint.com/:w:/s/Testing/ETuWSEOz6UVFnY-mzT5AO0YB_xR8CkLNeuXaCVqzLkGawL

It has the obvious advantage of being short - so the filename-length limitation would go away.

Can it be used to access the files, using VBA?

Thanks!

Developer technologies VB
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.