I have created a control (class) in VB.NET which reads data from a data file. It works fine with VB.NET. I would like to program it in VBA for creating some functions. My problem is how to create a global instance of this class. So, I do not have to read each time the data from the file.

In the following code, SteamTablesGrid is a class which is created in VB.NET. I created a global instance of it as StmTblGrd. In function ReadGrid i read the data file. But the function LiqProp does not work.

Any help is appreciated.

Mahendra


Code:
Dim StmTblGrd As New SteamTablesGrid
Public Function ReadGrid(Fname As String) As Boolean
    StmTblGrd.OpenGrid (Fname)
    ReadGrid = True
End Function
Public Function LiqProp(Temp As Double, Press As Double, Nprop As Integer) As Double
StmTblGrd.SepBoundary = 0
StmTblGrd.Temperature = Temp
StmTblGrd.Pressure = Press
LiqProp = StmTblGrd.LiqProp(Nprop)
End Function