I have developed a code for the purpose of get information from the server, well if I put the correct URL it works just fine , but if I put a wrong URL it give an error message and also debug.
I do not want to see the debug on the screen but a proper suppressing error handler with a message not allowing users to go to the IDE, this is creating a risk. Any idea?
I do not want to see the debug on the screen but a proper suppressing error handler with a message not allowing users to go to the IDE, this is creating a risk. Any idea?
Code:
Dim Company As New Dictionary
Dim n As Integer
Dim Request As Object
Dim strData As String
Dim stUrl As String
Dim Response As String
Dim requestBody As String
Set Company = New Dictionary
stUrl = "http://locahost:8080/nectorprime/code/selectCodes"
Set Request = CreateObject("MSXML2.XMLHTTP")
Company.Add "tpin", "1112623668"
Company.Add "bhfId", "100"
Company.Add "lastReqDt", Format((Me.txtItemClsResDatesr), "YYYYMMDD000000")
strData = JsonConverter.ConvertToJson(Company, Whitespace:=3)
requestBody = strData
With Request
.Open "POST", stUrl, False
.setRequestHeader "Content-type", "application/json"
.send requestBody
Response = .responsetext
End With
If Request.Status = 200 Then
MsgBox Request.responsetext, vbCritical, "Internal Audit Manager"
n = FreeFile()
Open "C:\Users\necto\Desktop\Testing\test.txt" For Output As #n
Print #n, strData
Close #n
Exit Sub
End If