Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Class module

hi guys,
Using "Excel 2002 VBA" book. This is the first instance
of creating a Class Module and I don't see how it is
created as a Class Module. After typing the code, I do
know how to save it as a "Class Module". Must be missing
something very basic here. Code is simple:

Option Explicit
Public Name As String
Public HoursPerWeek As Double
Public rate As Double

Public Function WeeklyPay() As Double
WeeklyPay = HoursPerWeek * rate
End Function

I have done some before, but have not created "Class
Modules"

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Class module

David,

In the VBA Editor, go to the Insert menu and choose Class Module.
Put your code there. Then, press F4 to display the properties
window and name the class module what you want the class to be
called.


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


"David" wrote in message
...
hi guys,
Using "Excel 2002 VBA" book. This is the first instance
of creating a Class Module and I don't see how it is
created as a Class Module. After typing the code, I do
know how to save it as a "Class Module". Must be missing
something very basic here. Code is simple:

Option Explicit
Public Name As String
Public HoursPerWeek As Double
Public rate As Double

Public Function WeeklyPay() As Double
WeeklyPay = HoursPerWeek * rate
End Function

I have done some before, but have not created "Class
Modules"

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Class module

Did you do Insert = Class Module and put your code there?

--

Regards,
Tom Ogilvy

"David" wrote in message
...
hi guys,
Using "Excel 2002 VBA" book. This is the first instance
of creating a Class Module and I don't see how it is
created as a Class Module. After typing the code, I do
know how to save it as a "Class Module". Must be missing
something very basic here. Code is simple:

Option Explicit
Public Name As String
Public HoursPerWeek As Double
Public rate As Double

Public Function WeeklyPay() As Double
WeeklyPay = HoursPerWeek * rate
End Function

I have done some before, but have not created "Class
Modules"

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Class module

Thanks. This worked, but I am still trying to understand
the "Class Module", so I am looking for some kind of a
definition on what is is I am doing. I am not new to
programming, but this is the first "Class module" I have
created. It appears I am creating am creating an object,
bt I am wondering if there is a definiation of what a
class module is is it's essence. I looked through the
knowledge base, but some how am missing the "essence" of
what a class is.

Thank you for your help. The book I am using is not very
explicate. The first example in it does not even work,
but comes up with an error?

-----Original Message-----
David,

In the VBA Editor, go to the Insert menu and choose

Class Module.
Put your code there. Then, press F4 to display the

properties
window and name the class module what you want the class

to be
called.


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


"David" wrote in

message
...
hi guys,
Using "Excel 2002 VBA" book. This is the first instance
of creating a Class Module and I don't see how it is
created as a Class Module. After typing the code, I do
know how to save it as a "Class Module". Must be

missing
something very basic here. Code is simple:

Option Explicit
Public Name As String
Public HoursPerWeek As Double
Public rate As Double

Public Function WeeklyPay() As Double
WeeklyPay = HoursPerWeek * rate
End Function

I have done some before, but have not created "Class
Modules"

Thanks



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Class module

Try going to Chip Site

http://www.cpearson.com/excel.htm

then go to the topics or pages index and see if you can capture the essence.

Search the news groups for posts by Chip - he has given some long
explanations of such concepts. Here are the results of a search I did:

http://tinyurl.com/yw2ev

for example, the first entry from above might be helpful. (includes
additional information from Stephen Bullen).

--
Regards,
Tom Ogilvy


"David" wrote in message
...
Thanks. This worked, but I am still trying to understand
the "Class Module", so I am looking for some kind of a
definition on what is is I am doing. I am not new to
programming, but this is the first "Class module" I have
created. It appears I am creating am creating an object,
bt I am wondering if there is a definiation of what a
class module is is it's essence. I looked through the
knowledge base, but some how am missing the "essence" of
what a class is.

Thank you for your help. The book I am using is not very
explicate. The first example in it does not even work,
but comes up with an error?

-----Original Message-----
David,

In the VBA Editor, go to the Insert menu and choose

Class Module.
Put your code there. Then, press F4 to display the

properties
window and name the class module what you want the class

to be
called.


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


"David" wrote in

message
...
hi guys,
Using "Excel 2002 VBA" book. This is the first instance
of creating a Class Module and I don't see how it is
created as a Class Module. After typing the code, I do
know how to save it as a "Class Module". Must be

missing
something very basic here. Code is simple:

Option Explicit
Public Name As String
Public HoursPerWeek As Double
Public rate As Double

Public Function WeeklyPay() As Double
WeeklyPay = HoursPerWeek * rate
End Function

I have done some before, but have not created "Class
Modules"

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
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM
please give an example of a class module. Mike[_33_] Excel Programming 1 July 24th 03 07:27 AM
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 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"