30203标识符预期错误

时间:2014-12-31 13:18:16

标签: vba vbscript

我试图让这个脚本作为Windows上的计划任务运行,使用在线编译器进行检查,突出显示消息VBNC30203标识符错误,我已查看此消息但没有实现的技能修复,任何帮助表示赞赏。

脚本的来源是:

http://www.642weather.com/weather/wxblog/php-scripts/scheduled-http-request-windows-task-scheduler/

我只是在脚本中输入了我的URL /文件名。

这是我的VBS代码:

Call LogEntry()

Sub LogEntry()

'Force the script to finish on an error.
On Error Resume Next

'Declare variables
Dim objRequest
Dim URL

'The URL link.
URL = "http://www.chatteris.biz/forecast-compare-include.php?log&config=am"

Set objRequest = CreateObject("Microsoft.XMLHTTP")

'Open the HTTP request and pass the URL to the objRequest object
objRequest.open "GET", URL , false

'Send the HTML Request
objRequest.Send

'Set the object to nothing
Set objRequest = Nothing

End Sub

2 个答案:

答案 0 :(得分:0)

通常在线编译器(例如tutorialspoint在线编译器) 您应该在Module VBModule范围内编写代码,并且需要Sub Main()。

编写如下代码:

Module VBModule

  Sub Main()
      ' Your code goes here
  End Sub

  ' Your functions / subs goes here

End Module

答案 1 :(得分:-1)

Module VBModule
    Sub Main()
        End Sub
    Public Function VAT(ByVal pCost As Double, Optional cRate As Double = 20) 
    cRate = (cRate + 100) / 100 
    Return pCost * cRate 
    End Function
    console.ReadLine()
End Module