我的第一個入口在這裏。VBA:通過子例程調用參數的轉發類型
編碼VBA,相當陌生。
============================================== ===================
目標:將座標輸入到對象/類中。
...裝置 「等中的」
現在解決方案:使用陣列,諸如
===================== ============================================
class1:
sub start()
Dim c2 as new Class2
Dim points() as Double
Redim points(7)
point(0) = ...
...
point(7) = ...
cs.draw points
end sub
等級2:
public Sub draw(points() as double)
...
end sub
================================================ =================
問題是:硬跟蹤女巫陣列插槽代表一個特定的興趣值。
我想要做的,是一樣的東西:
類1:
Type Properties
length As Double
keygripp As Double
diameter As Double
tapdiameter As Double
steerlength As Double
distance As Double
plateau As Double
End Type
sub start()
Dim c2 as new Class2
Dim points as Properties
point.length = ...
...
point.plateau = ...
cs.draw points
end sub
等級2:
public Sub draw(p as Properties) '<---- Class 2 also need access to properties?
...
doCoolStuff(p.length)
doOtherCoolStuff(p.keygripp, p.diameter)
...
end sub
我聲明類型屬性的全球莫名其妙,這樣的Class1和Class2中都會知道它是關於什麼的?
問候//馬丁
VB.NET,VBA和VBScript都是不同的。請[編輯]並刪除不相關的標籤。也請看[問]並參加[遊覽]。 – Bugs
不知道你希望我編輯什麼,只有「VBA」和「類型」作爲標籤。 – AutoMartin
它看起來已經[完成](http://stackoverflow.com/posts/43628561/revisions)由Lankymart AutoMartin。 – Bugs