在 VBA 中是否有与 C++
sizeof
函数等效的函数?
唯一类似的函数似乎是数组上的 Ubound
和 LBound
运算符。
Dim arr(1 to 4) as integer
MsgBox Ubound(arr)
但这与 C++ 代码并不是一回事:
int arr[10];
std::cout << sizeof(std::string) << "\t" << sizeof(arr);
最佳答案
我意识到这太晚了,但是......你想要的是 LenB()
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Debug.Print LenB("a") '==>2 i.e. ["a",0&]
Dim r as RECT
debug.print LenB(r) '==>16 i.e. 4 bytes for each long
关于c++ - Sizeof() 的 VBA 等价物?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12321404/