Dutchmaste
New Member
- Joined
- Jun 14, 2016
- Messages
- 23
- Office Version
- 365
- Platform
- Windows
We received a excel sheet from a third party with macro's. It works fine when using Office2016 and Windows 10 build 1709 or older. But when using Windows 10 build 1803 it always goes to CONNECTION ERROR :S
When we go to the original website it give back the response it should, but whenever using the excel sheet it doesn't seem to work. Checked with out security team but they state no security rules should be blocking this.
When we go to the original website it give back the response it should, but whenever using the excel sheet it doesn't seem to work. Checked with out security team but they state no security rules should be blocking this.
Code:
Sub Workbook_Open()
On Error GoTo Workbook_Open_error
Dim strResult As String
Dim objHTTP As Object
Dim URL As String
Dim cVersion As String
Dim i As Integer
cVersion = ThisWorkbook.Sheets(1).Range("A5")
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "http://www.awebsite.com/something.asp"
objHTTP.Open "GET", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHTTP.send
strResult = objHTTP.responseText
If cVersion <> strResult Or Len(strResult) = 0 Then
MsgBox "LOAD SHEET EXPIRED Please download new version"
Me.Application.ActiveWorkbook.Close SaveChanges:=False
End If
For i = 1 To Sheets.Count
ThisWorkbook.Sheets(i).Protect Password:="************", UserInterfaceOnly:=True
Next
Workbook_Open_exit:
Exit Sub
Workbook_Open_error:
MsgBox "CONNECTION ERROR"
Resume Workbook_Open_exit
End Sub
Last edited by a moderator: