Hi All
Really hope that someone can help with this. I've spent most of the day trying... and failing.
I have a few hundred PDF documents in a Shareholder folder and I'm looking to open them via an Excel hyperlink.
The code below works when the files are saved on my local drive, but fails when trying to open the Sharepoint version. If I was the only one accessing the files I'd just save them to my laptop, but there will be quite a few people in my company who will be using it.
Any help would be very much appreciated!
Many thanks
Mark
Really hope that someone can help with this. I've spent most of the day trying... and failing.
I have a few hundred PDF documents in a Shareholder folder and I'm looking to open them via an Excel hyperlink.
The code below works when the files are saved on my local drive, but fails when trying to open the Sharepoint version. If I was the only one accessing the files I'd just save them to my laptop, but there will be quite a few people in my company who will be using it.
VBA Code:
Function OpenAnyFile(strPath As String)
Set objShell = CreateObject("Shell.Application")
objShell.Open (strPath)
End Function
Sub Test() ' get PDF from Sharepoint folder
Dim pdfPath As String
(Option 1 - works) pdfPath = "C:\Users\me...\PDF Images\13110014.pdf"
(Option 2 - fails) pdfPath = "\\mycompany.sharepoint.com\sites\Shared Documents\Forms\AllItems.aspx?id=\sites\sitename\Shared Documents\2013\11 November\13110014.pdf"
(Option 3 - fails) pdfPath = "https://mycompany.sharepoint.com/sites/Shared%20Documents/Forms/AllItems.aspx?id=%2Fsites%2Fsitename%2FShared%20Documents%2F/2013/11 November/13110014.pdf"
Call OpenAnyFile(pdfPath)
End Sub
Any help would be very much appreciated!
Many thanks
Mark