View Full Version : VBA Help in books
Djblois
07-16-2007, 08:49 AM
I have read a lot of books on VBA and I think I am pretty good at writing code now. However two topics elude me and I would like to get much better at them:
1) Classes
2) Arrays
All the books I have read go into them very little. Can anyone suggest any good books on these topics or articles? Also, if anyone can suggest any other advanced topics.
Thank you,
Daniel
Bob Phillips
07-16-2007, 09:07 AM
They are not specifically VBA topics, but are more general VB topics. There is a good explanation of both in Paul Lomax's VB&VB In a Nutshell book, published by O'Reilly.
However, as with most other books, it tends to cover what they are, how to manipulate them. What it doesn't really cover IMO is when and where to use them as against say just simple modularisation, and as against collections or a dictionary object.
matthewspatrick
07-17-2007, 06:37 AM
Daniel,
I tend to use arrays mainly in "array transfer". When I need to get a
bulk of data from a worksheet into memory and/or put a bulk of data
into a worksheet, using arrays can result in huge performance gains.
I just started using classes in the last several months, and generally
I use them to implement a hierarchical data model. On the project
where I started using classes, I had to update a tool I use that
processes observation data that my company collects.
1) The data comprised information about CUSTOMER SESSIONS:
where the sessions took place, when, who observed the sessions,
how long the sessions lasted, the transactions conducted. At the
top level, I instituted clsSessions as a collection of ClsSession
objects. clsSessions had properties like Count and Item, and
methods like Add, Remove, Import, Export, and Validate.
2) Each customer session was represented by a clsSession object.
This object had properties like Location, Date, Duration,
Observer, and Transactions, which returned a clsTransactions
object.
3) Each customer session had 1+ transactions; a clsTransactions
object represented a collection of clsTransaction objects for a single
customer session. Properties like Count and Item, and methods
like Add and Remove.
4) For each discrete transaction type in the session, there is a
clsTransaction object. Properties included Name and Quantity.
I am simplifying the actual problem here quite a bit (and not
showing all of the properties and methods!), but using classes
offered a very coherent structure for my app.
Djblois
07-17-2007, 06:58 AM
Would you mind posting some sample code of your classes for me to examine?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.