VBA: Following Hyperlink that's linked to Sharepoint?

Peter h

Active Member
Joined
Dec 8, 2015
Messages
417
I've got a list of Hyperlinks, that are all files on a sharepoint site. When I click on one, it opens Microsoft Edge and at the bottom asks if I want to open the file. When I click "Open", the file then opens in the appropriate desktop app. I'm wondering if there is a way around Microsoft Edge always asking if I want to open the file.

I'm building a File Search Userform that allows me to search and then open the selected file, but it is pretty inconvenient to have to click "Open" ever time I try to open something. Here is what I've got so far:

Code:
Private Sub btn_OpenFile_Click()
    
    Dim currWKB         As Workbook
    Dim fWKS            As Worksheet
    Dim fCell           As Range
    
    Dim fNAME           As String
    
    Set currWKB = ThisWorkbook
    Set fWKS = currWKB.Sheets(1)
    
    If Me.lb_Files.Text = "" Then
        MsgBox "Please select a file from the List Box that you'd like to open.", vbOKOnly
        Exit Sub
    Else
        fNAME = Me.lb_Files.Text
        Set fCell = fWKS.Columns(1).Find(What:=fNAME, LookIn:=xlValues, _
                    SearchOrder:=xlByColumns, SearchDirection:=xlNext)
                    
        fCell.Hyperlinks(1).Follow
        
        currWKB.Activate
        
        If MsgBox(fNAME & " has been opened. Would you like to close the ""Sharepoint Search"" Workbook?" _
                & vbNewLine & vbNewLine & "Clicking No, will keep this file open in the background.", vbYesNo) = vbYes Then
                
            currWKB.Save
            currWKB.Close
        Else
            currWKB.Windows(1).WindowState = xlMinimized
        End If
    End If
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,224,816
Messages
6,181,141
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top