未记录的 vba 特殊关键字 - Circle 和 Scale [英] undocumented vba special keywords - Circle and Scale

查看:34
本文介绍了未记录的 vba 特殊关键字 - Circle 和 Scale的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VBA 文档定义了以下标记:

special-form = "Array" / "Circle" / "Input" / "InputB" / "LBound" / "Scale" / "UBound"

根据文档:

一个特殊形式是一个保留标识符,它在表达式中使用,就好像它是一个程序定义的过程名称,但它的参数有特殊的语法规则.

A special-form is a reserved-identifier that is used in an expression as if it was a program defined procedure name but which has special syntactic rules for its argument.

但是没有提到这些关键字的用途,也没有提到参数的数量、类型和返回值.

But there is no mention of the purpose of these keywords, nor there number, type of parameters and return values.

有些记录在其他地方:

  • Array 返回一个带有可变数量参数的文字数组
  • InputInputBline
  • 一起使用
  • LBoundUbound 分别返回数组的第一个和最后一个索引,与 VB 相同
  • Array returns a literal array with an variable number of parameters
  • Input and InputB are used with line
  • LBound and Ubound returns respectively tho first and last index of an array, same as VB

我的问题是:
CircleScale 的目的是什么?它们是如何使用的?

My question is:
What is the purpose of Circle and Scale and how are they used ?

我找到了 Circle 的正确(奇数)语法,它与 相同基本声明

I found the correct (odd) syntax of Circle which is the same as the BASIC statement

CIRCLE(xcenter, ycenter), radius[,[color][,[start],[end][,aspect]]]

并且没有给出任何语法错误(我没有发现任何提到 Scale 虽然它似乎没有任何参数)但我不能将它分配给一个变量,如果我尝试运行下面的代码(在语法上是正确的)我收到以下错误:

and gives no syntax error (I didn't find any mention of Scale though it doesn't seem to have any parameters) but I can't assign it to a variable, and if I try to run the code below (which is syntaxically correct) I get the following error:

没有合适对象的方法无效

Method not valid without suitable object

代码:

Sub test1()
    Circle (5, 5), 10
End Sub

Sub test2()
    Scale
End Sub

推荐答案

VB 从 QBASIC 继承了图形方法的奇怪语法(圆/比例是什么),VBA 进一步从 VB(基于它)继承了它们.据推测,与其在运行时删除这些构造的特殊解析规则,不如将它们作为 noop 保留更简单.

VB inherited the odd syntax of graphics methods (what circle/scale are) from QBASIC and VBA further inherited them from VB (upon which it is based). Presumably it was decided that rather than removing the special parsing rules for these constructs in the runtime, it was simpler to leave them as a noop.

感谢 Alex K.(见他的评论)

CREDIT TO Alex K. (see his comment)

这篇关于未记录的 vba 特殊关键字 - Circle 和 Scale的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆