VBAtypes的问题初学者
我是一个新手,我正在尝试学习VBA,我对这个代码有一个疑问:(对不起,英文错误,我不是母语的人)
Option Explicit Type rPaciente 'matriz de pacientes CodPaciente As Long PriorPaciente As Long IntvChegDistr As String Par1 As Double Par2 As Double Par3 As Double Par4 As Double IntvCheg As Double InstCheg As Double End Type Public mPaciente() As rPaciente Public glQtdPaciente As Long
Type
和End Type
之间的这些“东西”是什么,它们是我工作表范围内的单元格,是因为我在工作表中得到了像Par1,Par2,…,Par4这样的列,但没有名为IntvCheg的列既没有InstCheg 。 那么命令Public someting() As otherthing
意思是什么?
在此先感谢您的帮助。
Type
和End Type
之间的“Things”是rPaciente
types的成员。 它们没有映射到任何东西,它们只描述了这个types所包含的数据集合。
可能有一个例程,通过创buildtypes的实例并将表格中的值复制到实例的成员variables,将单元上的单元格映射到此types的成员。
Public someting() As otherthing
是一个types的数组otherthing
。 该声明不包括数组的维数,所以在它可以使用之前,您必须将其重新定义为:
ReDim someting(1 to 10)
types声明只是声明一个Visual Basictypes结构。 就像(真正简化的看法)在c + +中的struct
或任何实验语言中没有方法的类。
指令
Public mPaciente() As rPaciente
声明一个可能会被你的excel文件中的每一行填充的rPaciente对象的dinamyc数组。
指令
Public glQtdPaciente As Long
用名称glQtdPaciente
声明一个Long
types的variables