VBA HTTP POST无法正常工作

Lin*_*vel 12 vba ms-word word-vba

我正在尝试通过VBA发送HTTP帖子.这是我的代码部分

Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.Open "POST", url, False
objHTTP.setRequestHeader "User-Agent", "EPS 1.0"
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.setRequestHeader "content", postString
objHTTP.setRequestHeader "Content-Length", Len(postString)
objHTTP.send
Run Code Online (Sandbox Code Playgroud)

问题是,代码仅在postString小于65535字符时才起作用.如果超过65535字符,则会在下面的行中抛出错误:

错误:参数不正确

objHTTP.setRequestHeader "content", postString
Run Code Online (Sandbox Code Playgroud)

有关于此的任何想法?我是否需要设置任何其他参数才能使其解决?

Tim*_*ams 3

根据: https: //support.microsoft.com/en-us/kb/290591

应该有效

postString = "id=" & String(66000,"x")
Dim xmlhttp 
Set xmlhttp = Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send postString
Run Code Online (Sandbox Code Playgroud)

如果它不起作用则可能是您的服务器端设置出现问题。