我正在研究一個VB6應用程序,我想發送一個Type作爲參考,並以另一種形式存儲它。這可能嗎?是否可以在VB6/VBA中發送和存儲類型引用?
發送它是沒有問題的,我只是用ByRef
關鍵字:
public Sub SetStopToEdit(ByRef currentStop As StopType)
但是,當我嘗試使用設置存儲currentStop
接收模塊我得到的「所需的對象」錯誤在運行程序時:
Private stopToEdit As StopTypeModule.StopType
' ... Lots of code
Set stopToEdit = currentStop
StopType
被定義爲在模塊如下(不是類模塊):
Public Type StopType
MachineName As String
StartDate As Date
StartTime As String
Duration As Double
End Type
是否可以存儲發送的參考文獻,還是必須將StopType
轉換爲類?
雖然只設置一個局部變量的作品:
stopToEdit = currentStop
當stopToEdit
以後改變了變化不是發送到SetStopToEdit
變量可見。
我已經改變了原來的問題,並解答了一些問題。 :-) – Jonas 2008-09-24 12:20:42