0
Dim url, host, port, custId
host = "http://127.0.0.1"
port = ":80"
custId = "???"

If custId <> "" Then
    url = host & port & "/SalesPadRemoteLibrary/Web/OpenCustomer?Customer_Num=" _
          & custId
    Dim myRequest As WebRequest = WebRequest.Create(url)
    Dim myResponse As WebResponse = myRequest.GetResponse()
    myResponse.Close()
End If

I am having trouble with this piece of software. I get an "expected end of statement" error at line 8 character 15. I am not sure why. I have a similar piece of code that works, but the functionality is not exactly what I want. Am I initializing the Requests/Responses incorrectly?

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
  • 1
    You are mixing VBScript *(which is typeless, doesn’t support `As`)* with VB.Net it looks like, this example will never work. – user692942 Jan 15 '18 at 21:03
  • Thanks. This code was provided to me from a vendor. Is there a way to use webrequests in VBScript or is that something strictly for VB.net? – Isaac Wolinski Jan 15 '18 at 21:05
  • You could use the xmlhttp library [like in this example](https://stackoverflow.com/questions/204759/http-get-in-vbs), but not webrequests – JNevill Jan 15 '18 at 21:06
  • It’s pretty poor code and likely purely VB.Net so you’d need to compile it using Visual Studio. – user692942 Jan 15 '18 at 21:06
  • Here’s a [more thorough example](https://stackoverflow.com/a/37462944/692942) of working xhr code in VBScript. It entirely depends on what platform you intend to use, this would be far easier to implement using the .Net framework for example. – user692942 Jan 15 '18 at 21:08
  • Thanks guys. Unfortunately, VBScript is the only option for me. The software is used to link a phone system to a CRM system. I have it working now, but the code I use opens an unnecessary web browser when ran. I was seeing how I could get it working without this. – Isaac Wolinski Jan 15 '18 at 21:15

0 Answers0