VBA: Following Hyperlink that's linked to Sharepoint?

Peter h

Active Member
Joined
Dec 8, 2015
Messages
409
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
 

Forum statistics

Threads
1,082,371
Messages
5,365,055
Members
400,819
Latest member
Gossow

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top