WinHttp TLS1.2 possible? RRS feed

  • Question

  • Hi

    I'm using Excel VBA to push data through a web service API.

    The service provider is changing to TLS shortly.

    I notice that WinHttp (in VBA) only handles TLS1.0 which is insecure.  I did try an undocumented setting (SecureProtocols = 2056) to try and get TLS1.2 but this doesn't work.

    Set WHTTP = CreateObject("WinHTTP.WinHTTPrequest.5.1")
    WHTTP.Open "POST", url2, False
    WHTTP.setRequestHeader "Content-Type", "application/xml;charset=UTF-8"
    'WHTTP.Option WinHttpRequestOption_SecureProtocols = 2056
    mess = WHTTP.responseText

    Are there any workarounds to this problem or are Microsoft ever going to update their client tools?


    Lee Hawthorn ACMA, CGMA View my Performance Management blog at

    Friday, March 27, 2015 10:35 AM

All replies

  • Did you ever get a solution to this question? I've searched all over looking for a way to get WinHTTP.WinHTTPreqeust.5.1 to use TLS 1.2 with no success. 



    Thursday, April 23, 2015 10:38 PM
  • Hi Rory,

    I never found a solution to this, in the end I used an R script for the plumbing.


    Lee Hawthorn ACMA, CGMA View my Performance Management blog at

    Monday, April 27, 2015 8:11 AM
  • I've rewritten to this JScript:

    	var WinHttpRequestOption_SecureProtocols = 9;
    	var hreq = new ActiveXObject("WinHTTP.WinHTTPrequest.5.1");
    	hreq.Open("GET", "", false);
    	hreq.setRequestHeader("Content-Type", "application/xml;charset=UTF-8");
    	hreq.Option(WinHttpRequestOption_SecureProtocols) = 512; //2048 for TLS 1.2
    	WScript.Echo("Protocol: " + hreq.Option(WinHttpRequestOption_SecureProtocols)); //doesn't work?!?
    	WScript.Echo("Error processing data.\nError: " + e.number + "\nInfo: "+ e.description);

    And it seems to be working, except reading of the protocol set.

    Tested on Win 8.1

    Tuesday, July 14, 2015 6:22 PM
  • 2048
    Thursday, December 21, 2017 11:51 PM