This function will check if your file path is a URL and if it is secure (HTTPS) or not secure (HTTP). 'There was no double forward slash so return system path as is 'Set the Parse_Resource value to WebDAVURI 'This should be the root URL of the site. WebDAVURI = WebDAVURI & '\' & SplitURL(i)
WebDAVURI = WebDAVURI & SplitURL(i) & Else 'Do nothing because this array slot is empty 'Do nothing because we do not need the HTTPS element 'The code iterates through the array excluding unneeded components of the URL 'URL has been found so prep the WebDAVURI string SplitURL = Split(URL, '/',, vbBinar圜ompare) 'Split the URL into an array so it can be analyzed & reused If Not InStr(1, URL, '//', vbBinar圜ompare) = 0 Then 'Check for a double forward slash in the resource path. 'Uncomment the below line to test locally without calling the function & remove argument above Public Function Parse_Resource(URL As String) Then reference 'MyNewPathString' when using the target file location. This function also returns regular system paths and UNC paths unscathed.Ĭall this function by adding it into a module in your VBA project and entering MyNewPathString = Parse_Resource(myFileDialogStringVariable) just after your file dialog command and before using the path selected by the file dialog. I transform the URL into a WebDAV address using the following function I created.