|
楼主 |
发表于 2022-12-1 16:29
|
显示全部楼层
Public Sub test2()
str1 = ""
For a = 1 To 187
If a < 187 Then
str1 = str1 & Mid(Sheet1.Cells(a, 1), 2) & ","
Else: str1 = str1 & Mid(Sheet1.Cells(a, 1), 2)
End If
Next
Dim ws As Object
Dim ex As Object
Set ws = CreateObject("wscript.shell")
Set ex = ws.Exec("cmd /c ws.exe -n -1 -B 1048576 wss://vts.igiseis.com/pingtai/position?cookieId=d9375042-e71a-4998-8635-76c5636ba610")
ex.StdIn.Write "{'action':'sim_company_car_list','phone':'" & str1 & "','companyId':'518622737851658240'}" & vbCrLf
str2 = ""
Do Until ex.Stdout.atendofstream
str2 = str2 & ex.Stdout.Readline
Loop
Open ThisWorkbook.Path & "\ws.txt" For Output As #1
Print #1, str2
Close #1
MsgBox str2
End Sub
这样的代码如何在输出保存的时候,最好是直接转换str2 为UTF8编码,不知道这样可以吗? |
|