prompted by pootle's XLS extravaganza further up this sticky, i decided that this afternoon would be a good time for me to update my export-to-XLS stuff. i HATE to write this sort of code twice and i LOATHE copy/paste of old code into a new application and then attempting to understand my thinking from three years back as i try to inter-twine the old code with the new app.
since i owe pootle a post to this sticky - a little demo Class library featuring pootle's XLS stuff seems reasonable.
the ZIP contains a test/demo app: CPLtest.MDB, and a small library: iLib.MDB
iLib is a Class-Provider that feeds late-bind Classes to applications.
CPLtest exercises iLib and illustrates the calling convention.
the major 'facility' in iLib is iExcelClass which is a late-bind Class implementation of some of pootle's XLS stuff plus a couple of my own little twists. i hope iExcelClass doesn't break, but it is my first-draft of the code so there might be some holes: please PM me if you find anything bizarre (XLS Exists/Not is not brilliant - suggestions welcome).
a library with only one book is not that exciting, so i added a couple of old-faithfulls from my production library: iHashClass; iUserClass (need CAPICOM, WSH registered on the machine, but no A-reference required).
for the demo to have half a chance of working:
A2K or later
CAPICOM (iHashClass late-binds so won't error unless you call iHash)
WSH (iUserClass late-binds so won't error unless you call iUser)
save iLib as c:\temp\iLib.MDB
save CPLtest.MDB anywhere you like
ensure CPLtest.MDB has a functioning reference to iLib.MDB (should show up in object browser etc etc)
don't be disappointed with the load-speed. move to MDE and it is fine
MDE process is: convert iLib to your A-version; make iLib.MDE; delete reference in CPLtest.MDB to iLib.MDB; close; add reference to iLib.MDE in CPLtest.MDB; convert CPLtest.MDB to vour A-version; run /decompile on a copy of CPLtest.MDB; make CPLtest.MDE
even though the following warning appears in the code several times, i must repeat it here:
' /// CRITICALLY IMPORTANT
' /// in 'real life' iLib should be 'compiled' to .MDE
' ///
' /// if you are experimenting, you can use iLib as MDB (as CPLtest does), but
' /// BEFORE you run CPLtest.frmMain with iLib in MDB format do the following:
' /// Open CPLtest.MDB
' /// Alt-F11 (opens the Code window)
' /// menu: Tools/Options/General - select BreakOnUnhandledErrors
the reason is that at least one exit routine in iLib can generate runtime errors (handled with Resume Next) as it tidies up stuff like hidden non-interactive Excel instances and .mousepointer --- in MDB any setting other than BreakOnUnhandledErrors will break into the code leaving the instance and the eggtimer stranded if you click the wrong button. in MDE format this does not happen of course.
STRONGLY RECOMMEND that you do not have any open XLS with unsaved data if you are using iLib in MDB form.
INSIST that you read through all the code before you run CPLtest.frmMain
FIX for most crashes is a reboot, so don't have unsaved data sitting on your machine when you run this demo.
all the usual caveats: this is demo code and includes my first draft of a medium complexity class module developed on a sunday afternoon with a beer in my left hand - no guarantees ! !
izy
PS: if you have other Classes that should be added to iLib, PM me