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: 7,247
Default User Defined Type


It appears though that programming with (vba) for excel 2000

and vb.net are
two completely different worlds.


Yes, they are quite different. In VBA, a class module contains
one and only one class, whose name is the name of the module. For
your code, first create a new class module, F4 to bring up the
Properties window, and give it a name of LedgerTransaction. In
that module, put the following code:

Public Items As Collection
Public Index As Long

Private Sub Class_Initialize()
Set Items = New Collection
End Sub




Next, create a second class module, name it BankAccountLedger,
and place the following code in that module:

Public Name As String
Public Transactions As Collection
Public LedgerRange As Range

Private Sub Class_Initialize()
Set Transactions = New Collection
End Sub

Then, in your initialization code in a regular code module,
instantiate the classes with code like

Dim LT As LedgerTransaction
Dim BAL As BankAccountLedger
' other code
Set LT = New LedgerTransaction
Set BAL = New BankAccountLedger


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"WStoreyII" wrote in
message
...
I dont have much programming experience, but the little that i

do know is from visual basic.net. It appears though that
programming with (vba) for excel 2000 and vb.net are two
completely different worlds.

So what i need to know is how to make a class or an object that

i can manipulate in my code

I wish to make a Class that Will Be Called LedgerTransaction
this class will have two member variables
1) Items - which will have a collection of range objects that

contain the range of the particular transaction item
2) Index - which will be the index of the transaction

I will also need a class called BankAccountLedger
Wich will have three Member Variables
1) Name
2) Transactions - Collection of Transactions
3) Range the range of the ledger

now this is a very elementry process in vb.net
and i am sure that it is in vba to.
however i am missing something
i tried a classs module
and a user defined types
and received several different error messages.

If anyone could please help me understand this or send me to a

good tutorial i would be very grateful

WStoreyII



 
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
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
User defined type problem R Avery Excel Programming 1 May 26th 04 02:41 PM
User Defined type not defined Karpagam Excel Programming 1 May 16th 04 05:41 PM
User defined data type augustus108 Excel Programming 1 April 10th 04 05:11 PM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM


All times are GMT +1. The time now is 08:24 AM.

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"