libre office 类型定义的第一行中预期的符号

symbol expected in first line of libre office type definition

谈论一个新手!我无法编译第一行。 Basic syntax error: Symbol expected

REM  *****  BASIC  *****
Type xyz
    Dim sheet as object
    Dim cell as object
    dim range as object
End Type


Sub Main

End Sub

版本:6.0.2.1 (x64) 构建 ID:f7f06a8f319e4b62f9bc5095aa112a65d2f3ac89

工具->宏->编辑宏>

编译

Dim declares local variables within subroutines. Type statements不要使用它。

此错误难以诊断的原因是问题似乎出在 Type xyz,但那部分没问题。 IDE 突出显示第一个 Dim 语句之前的内容,这可能是解析器的一个小问题。以下代码显示,即使是评论也可以突出显示!

Type xyz
    'This comment will be highlighted because of the Dim error.
    Dim sheet as object
End Type

对于任何编译器来说,这种不准确并不罕见。错误消息通常会提供问题的线索,而不是准确说明问题出在哪里。