Below is the code. But if I comment out the Dim objRequest As MSXML2.XMLHTTP line and uncomment the Dim objRequest As Object , it will end with an error message:
Invalid parameter
Why and what (if anything) can I do with this?
Public Function GetSessionId(strApiId, strUserName, strPassword) As String Dim strPostData As String Dim objRequest As MSXML2.XMLHTTP 'Dim objRequest As Object ' strPostData = "api_id=" & strApiId & "&user=" & strUserName & "&password=" & strPassword Set objRequest = New MSXML2.XMLHTTP With objRequest .Open "POST", "https://api.clickatell.com/http/auth", False .setRequestHeader "Content-Type", "application/x-www-form-urlencoded" .send strPostData GetSessionId = .responseText End With End Function
Corey, yes, I know that I will need to do this so that my code works without reference to the MSXML type library. It's not a problem. Code doesn't work when using Dim objRequest As Object no matter if I use
Set objRequest = NEW MSXML2.XMLHTTP with reference, or
Set objRequest = CreateObject("MSXML2.XMLHTTP") without a link.
Brendan reynolds
source share