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:
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