LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Saving / Reading dynamic arrays to / from disk

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
--
Mike News
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving an array or class to disk Wired Hosting News Excel Programming 0 March 24th 06 10:54 PM
Saving onto Floppy Disk woodbunny Excel Worksheet Functions 1 August 17th 05 03:43 PM
Saving to disk Karen Excel Discussion (Misc queries) 2 January 7th 05 07:13 PM
Saving embedded object to disk cbhanes Excel Programming 0 May 10th 04 04:02 PM
Picture in Web Page (saving to disk) S. Stilwell Excel Programming 0 July 14th 03 11:29 PM


All times are GMT +1. The time now is 01:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"