假設我有調用自定義的庫文件(.dll); Library.dllVBA7編譯錯誤Excel中的Windows 7
中的庫,有一個叫做類; 類
我生成一個名爲TestObject的對象:
Dim testObject As New Library.Class
有一個功能叫做testFunction:
Function testFunction(var1 As Double, var2 As Double, var3 As Double, var4 As Double, _
var5 As Double, var6 As Integer, var7 As Double, var8 As Double, var9 As Double)
Call testSetup(var1, var2, var3, var4, var6, var7, var8, var9)
testFunction = testObject.Field(var5)
End Function
這個函數調用testSetup:
Sub testSetup(var1 As Double, var2 As Double, var3 As Double, var4 As Double, _
var5 As Double, var6 As Integer, var7 As Double, var8 As Double, var9 As Double)
testObject.Lat1 = var1
testObject.Lon1 = var2
testObject.Lat2 = var3
testObject.Lon2 = var4
testObject.mth = var6
testObject.GMT = var7
testObject.ssn = var8
testObject.icf = var9
End Sub
我的問題是在跑步時,如果我在該位置放置一個斷點
testObject.Lat1 = var1
在運行和步進到下一行,如果我懸停在對象
testObject.Lat1
我看到錯誤
對象變量或帶塊變量未設置
沒有崩潰,沒有明確的錯誤消息導致失敗。
任何人有任何想法?
我不知道,如果誤差在庫或代碼中?
而且它是從Excel中鍵入到單元格 = testFunction運行(VAR1,VAR2,VAR3 ....)
編輯:在評論更多信息
什麼是testObject的範圍? – 2013-02-27 18:55:24
你是什麼意思的範圍? Thx – user2111939 2013-02-27 20:01:27
請將testObject聲明爲模擬級別或公共級別。 – 2013-02-28 08:34:26