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,078,499
Messages
5,340,740
Members
399,393
Latest member
farlow

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top