Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default please give an example of a class module.

someone please explain how to create a class in VBA
eg class named swap
Public swapdb As clsswap
Private m_number As Byte
Private m_units, m_notional, m_libor, cvalue As Double
Private m_name, m_ticker As String
Private m_td, m_exdate, m_r1, m_r2, m_r3, m_r4 As Date





Public Property Get addnumber() As Double
addnumber = m_number 'new swap #
End Property

Public Property Let addnumber(ByVal newnumber As Double)
m_number = newnumber
End Property
Public Property Get addunits() As Double
addunits = m_units 'new swap units
End Property

Public Property Let addunits(ByVal newunits As Double)
m_units = newunits
End Property
Public Property Get addname() As String
addname = m_name 'new swap name
End Property

Public Property Let addname(ByVal newname As String)
m_name = newname
End Property
Public Property Get addticker() As String
addticker = m_ticker 'new swap ticker
End Property

Public Property Let addticker(ByVal newticker As String)
m_ticker = newticker
End Property
Public Property Get addnotional() As Double
addnotional = m_notional 'new notional amount
End Property

Public Property Let addnotional(ByVal newnotional As Double)
m_ticker = newnotional
End Property
Public Property Get addlibor() As Double
addlibor = m_libor 'new libor rate
End Property

Public Property Let addlibor(ByVal newlibor As Double)
m_libor = newlibor
End Property
Public Property Get addtd() As Date
addtd = m_td 'trade date
End Property

Public Property Let addtd(ByVal newtd As Date)
m_td = newtd
End Property
Public Property Get addexdate() As Date
addexdate = m_exdate 'expiration date
End Property

Public Property Let addexdate(ByVal newexdate As Date)
m_exdate = newexdate
End Property
Public Property Get addr1() As Date
addr1 = m_r1 'reset date1
End Property

Public Property Let addr1(ByVal newr1 As Date)
m_r1 = newr1
End Property
Public Property Get addr2() As Date
addr2 = m_r2 'reset date2
End Property

Public Property Let addr2(ByVal newr2 As Date)
m_r2 = newr2
End Property
Public Property Get addr3() As Date
addr3 = m_r3 'reset date3
End Property

Public Property Let addr3(ByVal newr3 As Date)
m_r3 = newr3
End Property
Public Property Get addr4() As Date
addr4 = m_r4 'reset date4
End Property

Public Property Let addr4(ByVal newr4 As Date)
m_r4 = newr4
End Property

Dim i As Byte
'i = 1
Public swapi As New swapdb

Public Sub addswap()
swapi.addnumber = Range("b2")
swapi.addname = Range("b4")
swapi.addtd = Range("b6")
swapi.addexdate = Range("b8")
swapi.addunits = Range("b10")
swapi.addnotional = Range("b12")
swapi.addlibor = Range("b14")
swapi.addticker = Range("b16")
swapi.addr1 = Range("b18")
swapi.addr2 = Range("b20")
swapi.addr3 = Range("b22")
swapi.addr4 = Range("b24")
end sub

what am i missing?

Thanks
Reply
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
Creating UDF by Class Module (Leo)? Leo Excel Discussion (Misc queries) 1 December 2nd 08 10:59 AM
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
Need some comments on my Utility_Move class module. jchen Excel Worksheet Functions 0 August 21st 06 07:05 PM
Userform with template class module problem Tom Ogilvy Excel Programming 0 July 17th 03 06:38 PM
how to declare a class module Kevin Excel Programming 5 July 15th 03 01:04 AM


All times are GMT +1. The time now is 06:40 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"