How do i declare and define a variable of a custom type in one line
如何在一行中声明和设置自定义类型。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Option Explicit Type Stackoverflow stack As String overflow As String End Type Sub WorkingExample() Dim example As Stackoverflow example.stack ="stack" example.overflow ="overflow" MsgBox (example.stack + example.overflow) End Sub Sub NotCompiling() Dim example As Stackoverflow = {.stack ="stack", .overflow ="overflow"} MsgBox (example.stack + example.overflow) End Sub |
在这个迷你示例中,
请说明如何将此
冒号是一条以回车符结尾的行。
1 | Sub WorkingExample():Dim example As Stackoverflow:example.stack ="stack":example.overflow ="overflow":MsgBox (example.stack + example.overflow):End Sub |