M
Mike
I have a dynamic array goShareInfo, which contains a dynamic array of
Type PriceInfo. In order for me to be able to save/read the array
properly, I have to save the dimensions of goShareInfo and set up the
array next time in the LoadShares procedure when I reload the
spreadsheet. Why do I have to do this when each element of IndexStruct
also contains an array of PriceInfo, but I don't have to do the same for
these - the arrays seem to get set up automatically.
I am using Office 2003 and if try and reload the array on the fly excel
just hangs
Type PriceInfo
ShareDate As Date
SharePrice As Double
End Type
Type IndexStruct
Index As String
Epic As String
FailureCount As Long
ShareName As String
zzNumDisp As Integer
ShareDets() As PriceInfo
End Type
Public goShareInfo() As IndexStruct
Sub LoadShares()
Dim liFile As Integer
Dim liNumShares As Long
Dim lsPath As String
lsPath = ThisWorkbook.Path & "\" & cSaveFile
liFile = FreeFile
Open lsPath For Binary As liFile
Get liFile, , liNumShares
ReDim goShareInfo(liNumShares)
Get liFile, , goShareInfo
Close liFile
End Sub
Sub SaveShares()
Dim liFile As Integer
Dim liNumShares As Long
Dim lsPath As String
lsPath = ThisWorkbook.Path & "\" & cSaveFile
If Dir(lsPath) <> "" Then Kill (lsPath)
liFile = FreeFile
Open lsPath For Binary As liFile
liNumShares = UBound(goShareInfo)
Put liFile, , liNumShares
Put liFile, , goShareInfo
Close liFile
End Sub
Type PriceInfo. In order for me to be able to save/read the array
properly, I have to save the dimensions of goShareInfo and set up the
array next time in the LoadShares procedure when I reload the
spreadsheet. Why do I have to do this when each element of IndexStruct
also contains an array of PriceInfo, but I don't have to do the same for
these - the arrays seem to get set up automatically.
I am using Office 2003 and if try and reload the array on the fly excel
just hangs
Type PriceInfo
ShareDate As Date
SharePrice As Double
End Type
Type IndexStruct
Index As String
Epic As String
FailureCount As Long
ShareName As String
zzNumDisp As Integer
ShareDets() As PriceInfo
End Type
Public goShareInfo() As IndexStruct
Sub LoadShares()
Dim liFile As Integer
Dim liNumShares As Long
Dim lsPath As String
lsPath = ThisWorkbook.Path & "\" & cSaveFile
liFile = FreeFile
Open lsPath For Binary As liFile
Get liFile, , liNumShares
ReDim goShareInfo(liNumShares)
Get liFile, , goShareInfo
Close liFile
End Sub
Sub SaveShares()
Dim liFile As Integer
Dim liNumShares As Long
Dim lsPath As String
lsPath = ThisWorkbook.Path & "\" & cSaveFile
If Dir(lsPath) <> "" Then Kill (lsPath)
liFile = FreeFile
Open lsPath For Binary As liFile
liNumShares = UBound(goShareInfo)
Put liFile, , liNumShares
Put liFile, , goShareInfo
Close liFile
End Sub