VBA to open Excel workbook from Sharepoint site and by pass "Open" requests

Mike UK

New Member
Joined
Dec 14, 2011
Messages
32
Hi,
The code below opens a workbook on our sharepoint site. The "Application.EnableEvents = False" bypasses the "Open / Cancel" request that appears at the bottom of the IE 11 but then the Downloads Box appears where you need to click open. How can you open the workbook and suppress the various open requests?

Sub OpenHyperlink()

Application.EnableEvents = False 'disable Events
ActiveWorkbook.FollowHyperlink Address:=Range("C2")
Application.EnableEvents = True 're-enable Events

End Sub
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Mike UK

New Member
Joined
Dec 14, 2011
Messages
32
This worked for me with the correct substitutions of file-path etc. Copied from a reply found to a similar question...

Option Explicit
Declare PtrSafe Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Sub DownloadFileAPI()
Dim strURL As String
Dim LocalFilePath As String
Dim DownloadStatus As Long

strURL = "http://data.iana.org/TLD/tlds-alpha-by-domain.txt"
LocalFilePath = "C:\Test\TEST2_tlds-alpha-by-domain.txt"
DownloadStatus = URLDownloadToFile(0, strURL, LocalFilePath, 0, 0)
If DownloadStatus = 0 Then
MsgBox "File Downloaded. Check in this path: " & LocalFilePath
Else
MsgBox "Download File Process Failed"
End If
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,099,122
Messages
5,466,818
Members
406,500
Latest member
Tknotmaxx

This Week's Hot Topics

Top