Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving a collection to an external file
I'm looking to see if someone has developed an approach to reading and
writing a 'collection' to an external file. Perhaps a 'cookie'? Any suggestions and thoughts on this topic appreciated. This is all from within VBA. The collection is not data on a worksheet. I suspect XML would work, only if I knew how. Can you give me some pointers? Thanks, - Pat |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving a collection to an external file
A collection is really a array of data structures in memory. If this was C
language and there wre no points in the sturctures you could save the continous memory locations as binary data to a file. Then read the file back. Basic doesn't allow you the access the same way C language does. Through language extension you can access DLL using the C Language structures so I guess it may be possible. the problem is there isn't a nice command to get the size of the structure like in clanguage sizeof(Mystructure) to get the byte count and there isn't any easy way of reading and writing the binary data. The easier approach would be to create CSV file of the data in the structure. Write a routine to dump the structure and another to upload the structure. "Dreiding" wrote: I'm looking to see if someone has developed an approach to reading and writing a 'collection' to an external file. Perhaps a 'cookie'? Any suggestions and thoughts on this topic appreciated. This is all from within VBA. The collection is not data on a worksheet. I suspect XML would work, only if I knew how. Can you give me some pointers? Thanks, - Pat |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving a collection to an external file
I guess your right. I decided on populating the collection and exporting it
to an XML file. Since each workbook (and worksheets) are different the populate collection, export to XML, read from XML and repopulate all have to be custom. However there are opportunities to make some "generic" support functions which reduces work and errors (when I get all the bugs out...). - Pat "Joel" wrote: A collection is really a array of data structures in memory. If this was C language and there wre no points in the sturctures you could save the continous memory locations as binary data to a file. Then read the file back. Basic doesn't allow you the access the same way C language does. Through language extension you can access DLL using the C Language structures so I guess it may be possible. the problem is there isn't a nice command to get the size of the structure like in clanguage sizeof(Mystructure) to get the byte count and there isn't any easy way of reading and writing the binary data. The easier approach would be to create CSV file of the data in the structure. Write a routine to dump the structure and another to upload the structure. "Dreiding" wrote: I'm looking to see if someone has developed an approach to reading and writing a 'collection' to an external file. Perhaps a 'cookie'? Any suggestions and thoughts on this topic appreciated. This is all from within VBA. The collection is not data on a worksheet. I suspect XML would work, only if I knew how. Can you give me some pointers? Thanks, - Pat |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Import External Data: Saving changes to the database | Excel Discussion (Misc queries) | |||
Problems with saving WorkSheets that have External Links | Excel Programming | |||
Saving Large .xls file to external drives | Excel Discussion (Misc queries) | |||
Saving an external file without making it active | Excel Programming | |||
External data queries within applcation collection | Excel Programming |