


Optional ByVal rebuildCache As Boolean = False) _Ĭonst vbErrInvalidFormatInResourceFile As Long = 325Ĭonst vbErrKeyAlreadyExists As Long = 457 Public Function GetWebPath(ByVal path As String, _ 'If no url path can be found, the input value will be returned unmodified. 'depending on the type of OneDrive account and synchronization. 'OneDrive in any way to an OneDrive/SharePoint URL, containing for example To use my solution, copy the following function into any standard code module: 'Function for converting OneDrive/SharePoint Local Paths synchronized to Note that this solution does not create a OneDrive 'share' link, to create such a link you need to use the Microsoft Graph API! The links created by this function will only work for the account that owns the remote folder that's being synchronized. That's why I can now offer a kind of solution here. 'The URL is pasted into the spreadsheet, and VBA creates the QR-code.ĭoing this generally is not easy at all, but luckily it is related to the more common problem of finding the local path when given the URL. '= I am not able to create code that gives me the URL to the pdf-file. OutputFileName:="C:Users\Name\OneDrive\MyMap\" & ID & ".pdf", _ 'Excel VBA put data into a word-document, and export it to pdf-file (saved to OneDrive): I've been struggling with this for a while, so I'm very happy if anyone can help. xlsm-file will be distributed to user with different Excel versions. The URL is used to create a QR code, so that anyone can read the pdf-file.įor now I have to find the URL manually and paste it in to the spreadsheet, before VBA creates the QR-code. I need to find some code that gives med the URL to this file, so that it can be typed into a cell.


My Exel VBA saves a pdf file to OneDrive locally "C:\Users\Name\OneDrive\FileName.pdf".
